[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] don't abort with error if realpath fails
From: |
Robert Millan |
Subject: |
Re: [PATCH] don't abort with error if realpath fails |
Date: |
Thu, 21 Sep 2006 19:34:19 +0200 |
User-agent: |
Mutt/1.5.13 (2006-08-11) |
On Thu, Sep 21, 2006 at 03:55:54AM +0200, Yoshinori K. Okuji wrote:
> On Sunday 17 September 2006 22:39, Robert Millan wrote:
> > Please consider (mostly useful to support device.map generated by GRUB
> > legacy):
> >
> > 2006-09-17 Robert Millan <address@hidden>
> >
> > * util/i386/pc/biosdisk.c (read_device_map): Don't abort with error if
> > realpath fails (e.g. to cope with missing /dev/fd0 when we're aren't
> > writing to floppy).
>
> Can you elaborate on the purpose? Personally I prefer a strict check for this
> part, since the installation of GRUB is potentially very dangerous!
Sure. The purpose of realpath here isn't really to verify device existance;
that ought to happen later if (and only if) we're actualy going to use that
device.
Suppose this device.map:
(hd0) /dev/hda
(xxx) /dev/idontexist
Theoricaly, when grub-setup is told to act on (hd0) it shouldn't care that
/dev/idontexist doesn't exist (it could be listed because it was generated
by an older grub, because the device disappeared, etc). However, because of the
realpath canonicalisation, as a collateral result we get to abort if _any_ of
the entries are wrong:
#ifdef __linux__
/* On Linux, the devfs uses symbolic links horribly, and that
confuses the interface very much, so use realpath to expand
symbolic links. */
map[drive] = xmalloc (PATH_MAX);
if (! realpath (p, map[drive]))
grub_util_error ("Cannot get the real path of `%s'", p);
#else
map[drive] = xstrdup (p);
#endif
My point is that grub should be fault tollerant and not care that
/dev/idontexist is broken, specialy since device.map is a file that is
subject for input from either user or older grub (including grub legacy),
and we have little control about its contents.
--
Robert Millan
My spam trap is address@hidden Note: this address is only intended for
spam harvesters. Writing to it will get you added to my black list.