Subject: Re: bin/36609: Fix {fdisk,disklabel}(8) device path parsing
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org,>
From: Alan Barrett <apb@cequrux.com>
List: netbsd-bugs
Date: 07/06/2007 06:35:04
The following reply was made to PR bin/36609; it has been noted by GNATS.

From: Alan Barrett <apb@cequrux.com>
To: gnats-bugs@NetBSD.org, gnats-admin@NetBSD.org,
	netbsd-bugs@NetBSD.org
Cc: 
Subject: Re: bin/36609: Fix {fdisk,disklabel}(8) device path parsing
Date: Fri, 6 Jul 2007 00:19:50 +0200

 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)