[Top][All Lists]

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

Bug in GNU Grub (under Linux with devfs)

From: Alejandro Liu
Subject: Bug in GNU Grub (under Linux with devfs)
Date: Mon, 14 May 2001 01:31:01 +0200


I found a bug with GNU Grub v0.5.96.1 when running under Linux v2.4.3 with devfs support. This only happens when running the Grub shell under Linux.

To recreate enter the GRUB shell and enter the commands:

root (hd0,2)
setup (hd0,2)

(Replace the disk/partition with whatever is appropriate). After the root command the program will respond with the fstype. This is correctly recognized. However the setup command fails with:

Error 22: No such partition

The problem can be traced to the file lib/device.c, line 617, function write_to_partition. It looks like a strcat is used when a strcpy should have been more apppropriate.

The diff output is as follows:

--- device.c~   Mon Oct 16 16:41:54 2000
+++ device.c    Mon May 14 03:19:58 2001
@@ -614,7 +614,7 @@
  if (have_devfs ())
      if (strcmp (dev + strlen(dev) - 5, "/disc") == 0)
-       strcat (dev + strlen(dev) - 5, "/part");
+       strcpy (dev + strlen(dev) - 5, "/part");
  sprintf (dev + strlen(dev), "%d", ((partition >> 16) & 0xFF) + 1);

The reason why the original doesn't work is that devfs creates a file /dev/discs/disc0/disc for the disc and /dev/discs/disc0/partN for the partitions. So the disc should be replaced with part not appended as it is being done now.

My regards, and thanks for writing a well done piece of software. (It has been working great for me until I switched on devfs)

Alejandro Liu

Prins Hendrikplein 52                 +31 (70) 317 6437
2264SN Leidschendam
The Netherlands

Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

reply via email to

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