Bug#600578: zfs_fix_mkrelpath.patch reverted upstream

Isaac Jurado diptongo at gmail.com
Sat Oct 23 19:48:45 UTC 2010


The inclusion of zfs_fix_mkrelpath.patch breaks grub-mkrelpath in other
scenarios.  For example in my case:

$ df -hT
S.ficheros    Tipo    Size  Used Avail Use% Montado en
/dev/sda3     ext4    7,4G  4,3G  2,8G  61% /
/dev/sda4     ext4    105G   66G   35G  66% /home
/dev/sda1     ext2     89M   19M   65M  23% /boot

$ grub-mkrelpath /boot
/boot

Where the output should have been "/".  Furhtermore, upstream revision
2904 reverts to the previous behaviour:

------------------------------------------------------------
revno: 2904
committer: Vladimir 'phcoder' Serbinenko <phcoder at gmail.com>
branch nick: grub
timestamp: Sat 2010-10-23 20:34:50 +0200
message:
        * grub-core/kern/emu/misc.c
        (grub_make_system_path_relative_to_its_root): Revert r2882.
diff:
=== modified file 'grub-core/kern/emu/misc.c'
--- grub-core/kern/emu/misc.c   2010-10-16 00:30:14 +0000
+++ grub-core/kern/emu/misc.c   2010-10-23 18:34:50 +0000
@@ -406,7 +406,21 @@
 
       /* buf is another filesystem; we found it.  */
       if (st.st_dev != num)
-       break;
+       {
+         /* offset == 0 means path given is the mount point.
+            This works around special-casing of "/" in Un*x.  This function never
+            prints trailing slashes (so that its output can be appended a slash
+            unconditionally).  Each slash in is considered a preceding slash, and
+            therefore the root directory is an empty string.  */
+         if (offset == 0)
+           {
+             free (buf);
+             free (buf2);
+             return xstrdup ("");
+           }
+         else
+           break;
+       }
 
       offset = p - buf;
       /* offset == 1 means root directory.  */
@@ -434,10 +448,7 @@
     }
 #endif
 
-  /* This works around special-casing of "/" in Un*x.  This function never
-     prints trailing slashes (so that its output can be appended a slash
-     unconditionally).  Each slash in it is considered a preceding slash,
-     and therefore the root directory is an empty string.  */
+  /* Remove trailing slashes, return empty string if root directory.  */
   len = strlen (buf3);
   while (len > 0 && buf3[len - 1] == '/')
     {

-- 
Isaac Jurado

"The noblest pleasure is the joy of understanding."
                                  Leonardo da Vinci





More information about the Pkg-grub-devel mailing list