Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Jun 2002 19:17:57 -0700 (PDT)
From:      KT Sin <ktsin@acm.org>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/38963: Unable to newfs vinum volumes
Message-ID:  <200206070217.g572HvqS089849@www.freebsd.org>

next in thread | raw e-mail | index | archive | help

>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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200206070217.g572HvqS089849>