grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Use realpath to clean up arguments to grub-probe


From: Colin Watson
Subject: Re: [PATCH] Use realpath to clean up arguments to grub-probe
Date: Mon, 15 Aug 2011 23:30:25 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Tue, Aug 02, 2011 at 07:54:40PM -0500, Mario Limonciello wrote:
> 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.

This would also fix Debian bug #637768 ("grub-probe doesn't follow
symlinks").

However, there is no reason to use realpath in new code when
canonicalize_file_name exists (and is implemented more safely).  I've
adjusted your patch to the following and committed it:

=== modified file 'ChangeLog'
--- ChangeLog   2011-08-15 22:21:29 +0000
+++ ChangeLog   2011-08-15 22:28:45 +0000
@@ -1,3 +1,11 @@
+2011-08-15  Mario Limonciello  <address@hidden>
+2011-08-15  Colin Watson  <address@hidden>
+
+       * util/grub-probe.c (probe): Canonicalise the path argument, fixing
+       use of "/path/.." as in grub-install for EFI as well as handling
+       symlinks correctly.
+       Fixes Debian bug #637768.
+
 2011-08-15  Colin Watson  <address@hidden>
 
        * util/grub-probe.c: Remove duplicate #include.

=== modified file 'util/grub-probe.c'
--- util/grub-probe.c   2011-08-15 22:21:29 +0000
+++ util/grub-probe.c   2011-08-15 22:25:13 +0000
@@ -180,7 +180,10 @@ probe (const char *path, char *device_na
 #endif
     }
   else
-    device_name = grub_guess_root_device (path);
+    {
+      grub_path = canonicalize_file_name (path);
+      device_name = grub_guess_root_device (grub_path);
+    }
 
   if (! device_name)
     grub_util_error ("cannot find a device for %s (is /dev mounted?)", path);

Thanks,

-- 
Colin Watson                                       address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]