Subject: Re: Disklabel's bug ? (or feature ?)
To: Arnaud Lacombe <>
From: David Laight <>
List: tech-userlevel
Date: 06/12/2006 20:29:48
On Mon, Jun 12, 2006 at 01:33:10AM +0200, Arnaud Lacombe wrote:
> Hi,
> I had a strange behaviour with disklabel tonight: I wanted to rework the
> geometry of a disk, but it was ever and ever returning the same old
> label (from an other old disk), and so, even when the disk was not connected.
> It finally turned out that I had a file called `rsd0' in /dev which was
> containing the first 100 sectors of the old disk, and disklabel was
> using this file.
> The strange behaviour is (I guess) that disklabel didn't check that the
> filemame is a valid device name (ie. like sd0[a-z]). The attached patch is a
> sample of test which can be done[1] (the '22' corresponds to
> MAXPARTITIONS). Furthermore, shouldn't opendisk() be sure that what it
> opens in /dev is really a device file ?

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.


David Laight: