Subject: Re: bin/36609: Fix {fdisk,disklabel}(8) device path parsing
To: None <gnats-bugs@NetBSD.org, gnats-admin@NetBSD.org,>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 07/06/2007 00:19:50
On Thu, 05 Jul 2007, Christos Zoulas wrote:
> Although what you proposed satisfies POLA, it is un-unix-like to parse and
> treat filenames specially, when filenames are accepted.

I think that opendisk(3) should do something like

	/* assume it's a disk name, until proven otherwise */
	if (arg contains "/") {
		interpret it as a file name;
		do not fall back to any other interpretation;
	} else {
		try various combinations of /dev/{,r}foo{,rawpart};
		if that fails, try interpreting it as a file name;
	}

In this scheme, users who want "./wd2" can ask for that explicitly,
while users who want "/dev/rwd2d" (where "d" is the raw partition) can
ask for any of "wd2", "wd2d", or "/dev/rwd2d".

I don't think it's un-unix-like for an interface that's intended to open
a "disk" to interpreting its argument as a disk name in preference to a
file name.

--apb (Alan Barrett)