From owner-svn-src-head@FreeBSD.ORG Fri Dec 12 16:32:06 2008 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 38CD41065670; Fri, 12 Dec 2008 16:32:06 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: from onelab2.iet.unipi.it (onelab2.iet.unipi.it [131.114.9.129]) by mx1.freebsd.org (Postfix) with ESMTP id E870F8FC0C; Fri, 12 Dec 2008 16:32:05 +0000 (UTC) (envelope-from luigi@onelab2.iet.unipi.it) Received: by onelab2.iet.unipi.it (Postfix, from userid 275) id 22AC673098; Fri, 12 Dec 2008 17:37:11 +0100 (CET) Date: Fri, 12 Dec 2008 17:37:11 +0100 From: Luigi Rizzo To: Paul Saab Message-ID: <20081212163711.GB18908@onelab2.iet.unipi.it> References: <200812121556.mBCFucKf001837@svn.freebsd.org> <5c0ff6a70812120814t2c184ec1jc05953a3db9ed319@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5c0ff6a70812120814t2c184ec1jc05953a3db9ed319@mail.gmail.com> User-Agent: Mutt/1.4.2.3i Cc: svn-src-head@freebsd.org, Luigi Rizzo , src-committers@freebsd.org, svn-src-all@freebsd.org Subject: Re: svn commit: r185990 - head/sbin/newfs X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Dec 2008 16:32:06 -0000 On Fri, Dec 12, 2008 at 08:14:52AM -0800, Paul Saab wrote: > This still will not work. zfs can have arbitrary names. So let me understand: this part of the code now is exactly as it was two weeks ago, before i touched it. So, are you (and Peter) addressing a pre-existing bug, or could you explain me what is broken now ? Also, are you actually seeing the bug when you run the program, or you just think there might be one ? cheers luigi > On Fri, Dec 12, 2008 at 7:56 AM, Luigi Rizzo wrote: > > > Author: luigi > > Date: Fri Dec 12 15:56:38 2008 > > New Revision: 185990 > > URL: http://svn.freebsd.org/changeset/base/185990 > > > > Log: > > Move the check for the ending char in the partition name where > > it was before -- the check is only made when getdisklabel() > > returns valid info. > > On passing, use MAXPARTITIONS to identify the max partition number, > > instead of the hardwired 'h' > > > > MFC after: 4 weeks > > > > Modified: > > head/sbin/newfs/newfs.c > > > > Modified: head/sbin/newfs/newfs.c > > > > ============================================================================== > > --- head/sbin/newfs/newfs.c Fri Dec 12 14:57:25 2008 (r185989) > > +++ head/sbin/newfs/newfs.c Fri Dec 12 15:56:38 2008 (r185990) > > @@ -354,11 +354,6 @@ main(int argc, char *argv[]) > > mediasize = st.st_size; > > /* set fssize from the partition */ > > } else { > > - part_name = special[strlen(special) - 1]; > > - if ((part_name < 'a' || part_name > 'h') && > > !isdigit(part_name)) > > - errx(1, "%s: can't figure out file system partition", > > - special); > > - > > if (sectorsize == 0) > > if (ioctl(disk.d_fd, DIOCGSECTORSIZE, §orsize) == -1) > > sectorsize = 0; /* back out on error for safety */ > > @@ -368,6 +363,12 @@ main(int argc, char *argv[]) > > pp = NULL; > > lp = getdisklabel(special); > > if (lp != NULL) { > > + if (!is_file) /* already set for files */ > > + part_name = special[strlen(special) - 1]; > > + if ((part_name < 'a' || part_name - 'a' >= MAXPARTITIONS) > > && > > + !isdigit(part_name)) > > + errx(1, "%s: can't figure out file system > > partition", > > + special); > > cp = &part_name; > > if (isdigit(*cp)) > > pp = &lp->d_partitions[RAW_PART]; > >