From nobody@FreeBSD.org  Thu Feb 25 21:06:32 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8A0051065675
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 25 Feb 2010 21:06:32 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id 7A7E28FC16
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 25 Feb 2010 21:06:32 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o1PL6WnB098659
	for <freebsd-gnats-submit@FreeBSD.org>; Thu, 25 Feb 2010 21:06:32 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o1PL6WGF098658;
	Thu, 25 Feb 2010 21:06:32 GMT
	(envelope-from nobody)
Message-Id: <201002252106.o1PL6WGF098658@www.freebsd.org>
Date: Thu, 25 Feb 2010 21:06:32 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: mdconfig -{d,l}n doesn't work
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         144300
>Category:       bin
>Synopsis:       [md] [patch] mdconfig(8): mdconfig -{d,l}n doesn't work
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    brucec
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Feb 25 21:10:01 UTC 2010
>Closed-Date:    Wed Feb 16 21:31:37 UTC 2011
>Last-Modified:  Sun Feb 03 22:28:04 UTC 2013
>Originator:     Garrett Cooper
>Release:        8-RELEASE / 9-CURRENT
>Organization:
Cisco Systems, Inc
>Environment:
>Description:
The mdconfig(1) implies that -n will squelch `md' prefixing with any mdconfig output...

     -n      When printing md device names, print only the unit number without
             the md prefix.

.. but that isn't the case:

# mdconfig -ln
md1
# uname -a
FreeBSD left4dead.cisco.com 9.0-CURRENT FreeBSD 9.0-CURRENT #0: Thu Feb 18 12:19:04 PST 2010     root@left4dead.cisco.com:/usr/obj/usr/src/sys/LEFT4DEAD  i386

1. The -n value only appears to be in use with the -a option (which doesn't make a lot of sense to me, but I dunno...).
2. There appears to be a problem with the default n_flag setting (it is set to random stack data unless specified on the command line), but even after fixing that, md is still output -- I didn't really want to waste cycles chasing down the culprit right now.

This issue is present in the RELENG_8 copy of FreeBSD as well.
>How-To-Repeat:
dd if=/dev/zero conv=sparse of=foo
mdconfig -a -t vnode -u 1 -f foo
mdconfig -l -n
>Fix:


>Release-Note:
>Audit-Trail:

From: Alexander Best <alexbestms@wwu.de>
To: <bug-followup@FreeBSD.org>
Cc: Garrett Cooper <yaneurabeya@gmail.com>
Subject: Re: bin/144300: mdconfig(8): mdconfig -{d,l}n doesn't work
Date: Fri, 26 Feb 2010 21:00:13 +0100 (CET)

   This is a MIME encoded multipart message.
 
 --+permail-20100226200013f0889e8400007f93-a_best01+
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 does this little patch take care of it?
 
 
 cheers.
 alex
 
 --+permail-20100226200013f0889e8400007f93-a_best01+
 Content-Type: text/plain
 Content-Transfer-Encoding: Base64
 Content-Disposition: attachment; filename="mdconfig.c.diff.txt"
 
 SW5kZXg6IHNiaW4vbWRjb25maWcvbWRjb25maWcuYwo9PT09PT09PT09PT09PT09PT09PT09PT09
 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09Ci0tLSBzYmluL21kY29u
 ZmlnL21kY29uZmlnLmMJKHJldmlzaW9uIDIwNDM2NSkKKysrIHNiaW4vbWRjb25maWcvbWRjb25m
 aWcuYwkod29ya2luZyBjb3B5KQpAQCAtMzczLDcgKzM3Myw3IEBACiAJCQkJCWZvdW5kID0gMTsK
 IAkJCX0KIAkJCWdjID0gJnBwLT5sZ19jb25maWc7Ci0JCQlwcmludGYoIiVzIiwgcHAtPmxnX25h
 bWUpOworCQkJcHJpbnRmKCIlcyVkIiwgbmZsYWcgPyAiIiA6IE1EX05BTUUsIG1kaW8ubWRfdW5p
 dCk7CiAJCQlpZiAob3B0ICYgT1BUX1ZFUkJPU0UgfHwgb3B0ICYgT1BUX1VOSVQpIHsKIAkJCQl0
 eXBlID0gZ2VvbV9jb25maWdfZ2V0KGdjLCAidHlwZSIpOwogCQkJCWlmIChzdHJjbXAodHlwZSwg
 InZub2RlIikgPT0gMCkK
 
 --+permail-20100226200013f0889e8400007f93-a_best01+--

From: Garrett Cooper <yaneurabeya@gmail.com>
To: Alexander Best <alexbestms@wwu.de>
Cc: "<bug-followup@FreeBSD.org>" <bug-followup@FreeBSD.org>,
 Garrett Cooper <yaneurabeya@gmail.com>
Subject: Re: bin/144300: mdconfig(8): mdconfig -{d,l}n doesn't work
Date: Fri, 26 Feb 2010 12:52:17 -0800

 On Feb 26, 2010, at 12:00 PM, Alexander Best <alexbestms@wwu.de> wrote:
 
 > does this little patch take care of it?
 
 Yeah, that does the trick :}!
 -Garrett
State-Changed-From-To: open->analyzed 
State-Changed-By: linimon 
State-Changed-When: Fri Feb 26 22:26:03 UTC 2010 
State-Changed-Why:  
The contributed patch has been confirmed to fix the problem. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144300 
Responsible-Changed-From-To: freebsd-bugs->brucec  
Responsible-Changed-By: brucec 
Responsible-Changed-When: Mon Mar 22 20:37:38 UTC 2010 
Responsible-Changed-Why:  
Take. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144300 

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@freebsd.org,
 gcooper@freebsd.org
Cc:  
Subject: Re: bin/144300: [patch] mdconfig(8): mdconfig -{d,l}n doesn't work
Date: Mon, 22 Mar 2010 20:56:26 +0000

 The patch doesn't work when multiple devices are configured - it always prints 
 "md0" or "0".
 
 -- 
 Bruce Cran

From: Garrett Cooper <yaneurabeya@gmail.com>
To: Bruce Cran <bruce@cran.org.uk>
Cc: bug-followup@freebsd.org
Subject: Re: bin/144300: [patch] mdconfig(8): mdconfig -{d,l}n doesn't work
Date: Mon, 22 Mar 2010 15:07:32 -0700

 On Mon, Mar 22, 2010 at 1:56 PM, Bruce Cran <bruce@cran.org.uk> wrote:
 > The patch doesn't work when multiple devices are configured - it always prints
 > "md0" or "0".
 
     This is a bug with the RELENG_8 copy of mdconfig (9-CURRENT with
 my revision didn't do that). See: bin/144948 for more details.
 Thanks,
 -Garrett

From: Bruce Cran <bruce@cran.org.uk>
To: bug-followup@FreeBSD.org, gcooper@FreeBSD.org
Cc:  
Subject: Re: bin/144300: [patch] mdconfig(8): mdconfig -{d,l}n doesn't work
Date: Sat, 03 Apr 2010 12:17:20 +0100

 As discussed on IRC, the problem with the patch is also present on -CURRENT.
 
 -- 
 Bruce

From: Alexander Best <arundel@freebsd.org>
To: bug-followup@freebsd.org
Cc:  
Subject: Re: bin/144300: [patch] mdconfig(8): mdconfig -{d,l}n doesn't work
Date: Tue, 24 Aug 2010 22:55:36 +0000

 --HlL+5n6rz5pIUxbD
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: inline
 
 how about something like the following patch?
 
 cheers.
 alex
 
 -- 
 a13x
 
 --HlL+5n6rz5pIUxbD
 Content-Type: text/plain; charset=us-ascii
 Content-Disposition: attachment; filename="mdconfig.c.diff2"
 
 Index: /usr/src/sbin/mdconfig/mdconfig.c
 ===================================================================
 --- /usr/src/sbin/mdconfig/mdconfig.c	(revision 211393)
 +++ /usr/src/sbin/mdconfig/mdconfig.c	(working copy)
 @@ -373,7 +373,7 @@
  					found = 1;
  			}
  			gc = &pp->lg_config;
 -			printf("%s", pp->lg_name);
 +			printf("%s", nflag ? pp->lg_name+2: pp->lg_name);
  			if (opt & OPT_VERBOSE || opt & OPT_UNIT) {
  				type = geom_config_get(gc, "type");
  				if (strcmp(type, "vnode") == 0)
 
 --HlL+5n6rz5pIUxbD--
State-Changed-From-To: analyzed->patched 
State-Changed-By: brucec 
State-Changed-When: Sun Feb 13 18:30:35 UTC 2011 
State-Changed-Why:  
Patch committed to HEAD. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144300 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144300: commit references a PR
Date: Sun, 13 Feb 2011 18:30:22 +0000 (UTC)

 Author: brucec
 Date: Sun Feb 13 18:30:17 2011
 New Revision: 218652
 URL: http://svn.freebsd.org/changeset/base/218652
 
 Log:
   Only print the unit number when invoked with the -n flag.
   
   PR:	bin/144300
   Submitted by:	arundel
   MFC after:	3 days
 
 Modified:
   head/sbin/mdconfig/mdconfig.c
 
 Modified: head/sbin/mdconfig/mdconfig.c
 ==============================================================================
 --- head/sbin/mdconfig/mdconfig.c	Sun Feb 13 18:21:41 2011	(r218651)
 +++ head/sbin/mdconfig/mdconfig.c	Sun Feb 13 18:30:17 2011	(r218652)
 @@ -373,7 +373,7 @@ md_list(char *units, int opt)
  					found = 1;
  			}
  			gc = &pp->lg_config;
 -			printf("%s", pp->lg_name);
 +			printf("%s", nflag ? pp->lg_name + 2 : pp->lg_name);
  			if (opt & OPT_VERBOSE || opt & OPT_UNIT) {
  				type = geom_config_get(gc, "type");
  				if (strcmp(type, "vnode") == 0)
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144300: commit references a PR
Date: Wed, 16 Feb 2011 21:21:29 +0000 (UTC)

 Author: brucec
 Date: Wed Feb 16 21:21:23 2011
 New Revision: 218752
 URL: http://svn.freebsd.org/changeset/base/218752
 
 Log:
   MFC r218652, r218677:
   
   Only print the unit number when invoked with the -n flag.
   
   PR:	bin/144300
   Submitted by:	arundel
 
 Modified:
   stable/8/sbin/mdconfig/mdconfig.c
 Directory Properties:
   stable/8/sbin/mdconfig/   (props changed)
 
 Modified: stable/8/sbin/mdconfig/mdconfig.c
 ==============================================================================
 --- stable/8/sbin/mdconfig/mdconfig.c	Wed Feb 16 21:13:02 2011	(r218751)
 +++ stable/8/sbin/mdconfig/mdconfig.c	Wed Feb 16 21:21:23 2011	(r218752)
 @@ -373,7 +373,11 @@ md_list(char *units, int opt)
  					found = 1;
  			}
  			gc = &pp->lg_config;
 -			printf("%s", pp->lg_name);
 +			if (nflag && strncmp(pp->lg_name, "md", 2) == 0)
 +				printf("%s", pp->lg_name + 2);
 +			else
 +				printf("%s", pp->lg_name);
 +
  			if (opt & OPT_VERBOSE || opt & OPT_UNIT) {
  				type = geom_config_get(gc, "type");
  				if (strcmp(type, "vnode") == 0)
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/144300: commit references a PR
Date: Wed, 16 Feb 2011 21:24:13 +0000 (UTC)

 Author: brucec
 Date: Wed Feb 16 21:24:09 2011
 New Revision: 218754
 URL: http://svn.freebsd.org/changeset/base/218754
 
 Log:
   MFC r218652, r218677:
   
   Only print the unit number when invoked with the -n flag.
   
   PR:	bin/144300
   Submitted by:	arundel
 
 Modified:
   stable/7/sbin/mdconfig/mdconfig.c
 Directory Properties:
   stable/7/sbin/mdconfig/   (props changed)
 
 Modified: stable/7/sbin/mdconfig/mdconfig.c
 ==============================================================================
 --- stable/7/sbin/mdconfig/mdconfig.c	Wed Feb 16 21:23:09 2011	(r218753)
 +++ stable/7/sbin/mdconfig/mdconfig.c	Wed Feb 16 21:24:09 2011	(r218754)
 @@ -363,7 +363,11 @@ md_list(char *units, int opt)
  					found = 1;
  			}
  			gc = &pp->lg_config;
 -			printf("%s", pp->lg_name);
 +			if (nflag && strncmp(pp->lg_name, "md", 2) == 0)
 +				printf("%s", pp->lg_name + 2);
 +			else
 +				printf("%s", pp->lg_name);
 +
  			if (opt & OPT_VERBOSE || opt & OPT_UNIT) {
  				type = geom_config_get(gc, "type");
  				if (strcmp(type, "vnode") == 0)
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
State-Changed-From-To: patched->closed 
State-Changed-By: brucec 
State-Changed-When: Wed Feb 16 21:31:11 UTC 2011 
State-Changed-Why:  
Merged to stable/7 and stable/8. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=144300 
>Unformatted:
