Hi,

I've found that the EFI grub-install command can fail to properly figure out 
devices when using the --root-directory command.  This seems to be rooted from 
a call to grub-probe with a ".." in the path.

This is fixed by using realpath to clean up the path passed in grub-probe.  
Please see the attached patch.

Thanks,

-- 
*Mario Limonciello*
Linux Engineer
*Dell*| OS Engineering
=== modified file 'ChangeLog'
--- ChangeLog	2011-07-26 15:19:47 +0000
+++ ChangeLog	2011-08-03 00:48:10 +0000
@@ -1,3 +1,8 @@
+2011-08-02  Mario Limonciello <mario_limoncie...@dell.com>
+
+	* util/grub-probe.c: Use realpath to clean up directory arguments
+	including '..' such as that used in grub-install for EFI.
+
 2011-07-26  Colin Watson  <cjwat...@ubuntu.com>
 
 	* configure.ac: The Loongson port requires grub-mkfont due to its

=== modified file 'util/grub-probe.c'
--- util/grub-probe.c	2011-04-25 12:52:07 +0000
+++ util/grub-probe.c	2011-08-03 00:53:57 +0000
@@ -42,6 +42,9 @@
 #include <string.h>
 #include <stdlib.h>
 #include <sys/stat.h>
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
 
 #define _GNU_SOURCE	1
 #include <getopt.h>
@@ -181,7 +184,15 @@
 #endif
     }
   else
-    device_name = grub_guess_root_device (path);
+    {
+#ifdef PATH_MAX
+      grub_path = xmalloc (PATH_MAX);
+      realpath (path, grub_path);
+#else
+      grub_path = realpath(path, NULL);
+#endif
+    device_name = grub_guess_root_device (grub_path);
+    }
 
   if (! device_name)
     grub_util_error ("cannot find a device for %s (is /dev mounted?)", path);

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

Reply via email to