From owner-freebsd-bugs Fri Jun 7 2: 0:26 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 24F0637B408 for ; Fri, 7 Jun 2002 02:00:06 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g57906f48108; Fri, 7 Jun 2002 02:00:06 -0700 (PDT) (envelope-from gnats) Date: Fri, 7 Jun 2002 02:00:06 -0700 (PDT) Message-Id: <200206070900.g57906f48108@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: bin/38963: Unable to newfs vinum volumes Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/38963; it has been noted by GNATS. From: Bruce Evans To: KT Sin Cc: freebsd-gnats-submit@FreeBSD.ORG Subject: Re: bin/38963: Unable to newfs vinum volumes Date: Fri, 7 Jun 2002 18:53:13 +1000 (EST) On Thu, 6 Jun 2002, KT Sin wrote: > The attempt to remove -v flag in revision 1.60 of newfs.c broke newfs when newfsing vinum volumes. > > A snippet of the diff to rev 1.59: > > @@ -279,11 +274,11 @@ main(int argc, char *argv[]) > if (lp != NULL) { > cp = strchr(special, '\0'); > cp--; > - if (!vflag && (*cp < 'a' || *cp > 'h') && !isdigit(*cp)) > + if ((*cp < 'a' || *cp > 'h') && !isdigit(*cp)) > errx(1, "%s: can't figure out file system partition", > special); > - if (vflag || isdigit(*cp)) > - pp = &lp->d_partitions[0]; > + if (isdigit(*cp)) > + pp = &lp->d_partitions[RAW_PART]; > else > pp = &lp->d_partitions[*cp - 'a']; > oldpartition = *pp; > > We should not have removed vflags from all conditional statements blindly. A better approach is to implicitly set vflag to 1 since we want to make -v the default behaviour. I think it is not so simple. -v can't be the default behaviour, because it is inconsistent with the use of a partition other than RAW_PART. This wasn't a problem when there was a -v flag. You could just not use -v when newfs'ing a partition. > >Fix: > --- sbin/newfs/newfs.c.orig Thu May 16 15:36:55 2002 > +++ sbin/newfs/newfs.c Fri Jun 7 09:52:02 2002 > @@ -274,13 +274,7 @@ > if (lp != NULL) { > cp = strchr(special, '\0'); > cp--; > - if ((*cp < 'a' || *cp > 'h') && !isdigit(*cp)) > - errx(1, "%s: can't figure out filesystem partition", > - special); > - if (isdigit(*cp)) > - pp = &lp->d_partitions[RAW_PART]; > - else > - pp = &lp->d_partitions[*cp - 'a']; > + pp = &lp->d_partitions[RAW_PART]; > oldpartition = *pp; > if (pp->p_size == 0) > errx(1, "%s: `%c' partition is unavailable", This gives the RAW partition in all cases, so at least the check of the partition size is wrong if the device is a partition but not the RAW one (but at least this wrongness is unimportant in most cases, since we have checked the correct size early after getting it with DIOCMEDIASIZE). Bringing back the -v flag seems to be the best way to fix this, short of dropping support for partitions. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message