From owner-freebsd-bugs Thu Jun 6 19:20:16 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 720A537B403 for ; Thu, 6 Jun 2002 19:20:01 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.6/8.11.6) id g572K1785069; Thu, 6 Jun 2002 19:20:01 -0700 (PDT) (envelope-from gnats) Received: from nwww.freebsd.org (www.FreeBSD.org [216.136.204.117]) by hub.freebsd.org (Postfix) with ESMTP id E0DFF37B40B for ; Thu, 6 Jun 2002 19:17:57 -0700 (PDT) Received: from www.freebsd.org (localhost [127.0.0.1]) by nwww.freebsd.org (8.12.2/8.12.2) with ESMTP id g572HvhG089850 for ; Thu, 6 Jun 2002 19:17:57 -0700 (PDT) (envelope-from nobody@www.freebsd.org) Received: (from nobody@localhost) by www.freebsd.org (8.12.2/8.12.2/Submit) id g572HvqS089849; Thu, 6 Jun 2002 19:17:57 -0700 (PDT) Message-Id: <200206070217.g572HvqS089849@www.freebsd.org> Date: Thu, 6 Jun 2002 19:17:57 -0700 (PDT) From: KT Sin To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-1.0 Subject: bin/38963: Unable to newfs vinum volumes 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 >Number: 38963 >Category: bin >Synopsis: Unable to newfs vinum volumes >Confidential: no >Severity: serious >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Jun 06 19:20:01 PDT 2002 >Closed-Date: >Last-Modified: >Originator: KT Sin >Release: 5.0-CURRENT >Organization: daddylonglegs.com >Environment: FreeBSD passion.daddylonglegs.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Mon Jun 3 22:55:19 SGT 2002 ktsin@passion.daddylonglegs.com:/usr/src/sys/i386/compile/PASSION i386 >Description: passion:~[624]# newfs /dev/vinum/work newfs: /dev/vinum/work: can't figure out filesystem partition 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. When vflag is 1, (!vflag && (*cp < 'a' || *cp > 'h') && !isdigit(*cp)) is always false and (vflag || isdigit(*cp)) is always true. >How-To-Repeat: Just run newfs on a vinum volume. 8) >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", >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message