[Bug 463015] Re: grub-probe incorrectly identifies ext3 as fat

Andrew Clausen clausen at econ.upenn.edu
Thu Oct 29 03:00:52 UTC 2009


Here's the patch I promised.  In order for a file system to be
considered detected, dir() must not only succeed, it also must find at
least one file or directory.  This is pretty effective at ruling out
misdetecting a filesystem based on a stale signature that wasn't wiped
by mkfs.  This shouldn't have any collateral damage, because empty file
systems are useless to Grub.

The patch is against the latest beta from alpha.gnu.org, but this code
looks stable, and should apply cleanly to any version.  Can someone
please forward this upstream?  I can be contacted at
clausen at econ.upenn.edu if this patch isn't clear.

--- grub-1.97~beta4/kern/fs.c	2009-07-16 18:14:09.000000000 -0400
+++ grub-1.97~beta4-fixed/kern/fs.c	2009-10-28 22:36:49.000000000 -0400
@@ -65,12 +65,14 @@
 grub_fs_probe (grub_device_t device)
 {
   grub_fs_t p;
+  int found_file;
   auto int dummy_func (const char *filename,
 		       const struct grub_dirhook_info *info);
 
   int dummy_func (const char *filename __attribute__ ((unused)),
 		  const struct grub_dirhook_info *info  __attribute__ ((unused)))
     {
+      found_file = 1;
       return 1;
     }
 
@@ -82,8 +84,10 @@
       for (p = grub_fs_list; p; p = p->next)
 	{
 	  grub_dprintf ("fs", "Detecting %s...\n", p->name);
+
+	  found_file = 0;
 	  (p->dir) (device, "/", dummy_func);
-	  if (grub_errno == GRUB_ERR_NONE)
+	  if (grub_errno == GRUB_ERR_NONE && found_file)
 	    return p;
 
 	  grub_error_push ();

-- 
grub-probe incorrectly identifies ext3 as fat
https://bugs.launchpad.net/bugs/463015
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.

-- 
ubuntu-bugs mailing list
ubuntu-bugs at lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs




More information about the universe-bugs mailing list