On Sun, Sep 13, 2009 at 07:58:56PM +0100, ago wrote:
> On fezie's request I am reporting a possible bug that I experienced
> when running the following:
> 
> loopback loop0 /path/to/myfile
> if [ -e (loop0)/some/file ]; then
>  echo ok
> fi
> 
> If /path/to/myfile does not contain a filesystem, grub2 crashes (there
> is a sudden restart) when I run the test.

The following patch fixes this. OK to commit?

2009-09-14  Colin Watson  <cjwat...@ubuntu.com>

        * commands/test.c (get_fileinfo): Return immediately if
        grub_fs_probe fails.

Index: commands/test.c
===================================================================
--- commands/test.c     (revision 2593)
+++ commands/test.c     (working copy)
@@ -88,6 +88,13 @@ test_parse (char **args, int *argn, int argc)
       }
 
     fs = grub_fs_probe (dev);
+    if (! fs)
+      {
+       grub_free (device_name);
+       grub_device_close (dev);
+       return;
+      }
+
     pathname = grub_strchr (path, ')');
     if (! pathname)
       pathname = path;

-- 
Colin Watson                                       [cjwat...@ubuntu.com]


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

Reply via email to