grub-devel
[Top][All Lists]
Advanced

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

[patch] grub incorrectly identifies ext3 as fat


From: Andrew Clausen
Subject: [patch] grub incorrectly identifies ext3 as fat
Date: Thu, 29 Oct 2009 14:58:09 +0000

Hi all,

grub (both the boot loader, and grub-probe) incorrectly identifies my
ext3 partition as containing a fat file system. This means it can't
boot without manual tweaking.  The problem is caused by stale fat
signatures... this is probably a common problem, as mke2fs often
doesn't wipe old signatures.

I wrote a patch.  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.

I filed a bug report here:
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/463015

--- 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 ();

Cheers,
Andrew




reply via email to

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