Subject: Re: Disklabel's bug ? (or feature ?)
To: None <firstname.lastname@example.org>
From: Arnaud Lacombe <email@example.com>
Date: 06/13/2006 10:36:16
On Mon, Jun 12, 2006 at 08:29:48PM +0100, David Laight wrote:
> IMHO no, disklabel cannot know what are valid disk names, and there
> are some very good reasons why it (and opendisk() in general) can be
> run on a regular file.
Yes, I perfectly understand that.
Now, opendisk() works as follow: it tries to open the path given by
disklabel, if it fails, it tries to open the path with the rawpart
appended, if it fails again, it will try (after check) to concatenate
"/dev/" + the path , and finally, "/dev/" + the path + 'X' 
If I pass "sd0" to disklabel, opendisk will try to open the following
files: "./sd0", "./sd0X", "/dev/sd0", "/dev/sd0X". What I propose is
to check that file opened under '/dev' are *really* device file. I don't
see any reason to have a regular file named 'sd0' under /dev, except
manipulation mistake, which could be avoided by adding the extra check.
: X = 'a' + value returned by getrawpartition()