Forwarded as Requested.

----- Original message -----
From: "John van Spaandonk" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED], "Chmouel Boudjnah" <[EMAIL PROTECTED]>
Date: Sun, 17 Aug 2003 12:57:37 +0200
Subject: Re: [Cooker] [Bug 4737] [grub] New: seg fault during
installation of grub (0.93-2mdk)

On Thursday 14 August 2003 11:47, Chmouel Boudjnah wrote:

> For me this (bourrinage) patch fix it :
> 
> --- grub-0.93/lib/device.c.chmou        2003-08-14 11:33:57.000000000 +0200
> +++ grub-0.93/lib/device.c      2003-08-14 11:36:55.700163832 +0200
> @@ -581,7 +581,7 @@
>        if (check_device (name))
>         {
>           (*map)[num_hd + 0x80] = strdup (name);
> -         assert ((*map)[num_hd + 0x80]);
> +         //assert ((*map)[num_hd + 0x80]);
>           
>           /* If the device map file is opened, write the map.  */
>           if (fp)
> 
> 
> don't know what's wrong though...

Chmouel,

Can you forward the following also to the Cooker mailing list, because
for
several weeks I have not been able to post a single thing there. It's sad
:-/

I found several strange things in the grub code.
(And yes, I applied both the memcpy and gcc patches)

I inserted in my grub/main.c the following (debug) statements:
[...]
        case OPT_DEVICE_MAP:
          device_map_file = strdup (optarg);
  fprintf(stderr, "JvS in grub/main.c. We found a device_map file, 
optarg=%s\n", optarg);
  fprintf(stderr, "JvS in grub/main.c. and the device_map_file=%s\n", 
device_map_file);
          break;
[..]

And this is what happens:
[EMAIL PROTECTED] grub-0.93]$ grub/grub --device-map=/boot/grub/device.map
JvS in grub/main.c. We found a device_map file,
optarg=/boot/grub/device.map
JvS in grub/main.c. and the device_map_file=(null)

And this shows that strdup() does not work as advertised!

using debug statements I determined that the actual segmentation fault 
occurs within a system call to realpath() 
in function init_device_map() at line 553 of lib/device.c

(realpath() tries to find the real path for /dev/discs/disc0 by following 
the symlinks)

So there seems to be a problem with the use of standard system libraries
from grub.

I was not able to correct the problems.

I hope this analysis helps.
 
John


-- 
Chmouel -- http://www.chmouel.com/

Reply via email to