From nobody@FreeBSD.org  Wed Nov  4 04:11:12 2009
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 5F4B1106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  4 Nov 2009 04:11:12 +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 4E5A58FC1C
	for <freebsd-gnats-submit@FreeBSD.org>; Wed,  4 Nov 2009 04:11:12 +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 nA44BBcP081057
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 4 Nov 2009 04:11:11 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id nA44BBYK081025;
	Wed, 4 Nov 2009 04:11:11 GMT
	(envelope-from nobody)
Message-Id: <200911040411.nA44BBYK081025@www.freebsd.org>
Date: Wed, 4 Nov 2009 04:11:11 GMT
From: Brian Scott <brian@bunyatech.com.au>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Improve flexibility of mdconfig2 startup script
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         140261
>Category:       conf
>Synopsis:       [patch] Improve flexibility of mdconfig2 startup script
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-rc
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Wed Nov 04 04:20:01 UTC 2009
>Closed-Date:    
>Last-Modified:  Mon Jan  2 12:10:11 UTC 2012
>Originator:     Brian Scott
>Release:        7.2
>Organization:
Bunya Technology
>Environment:
FreeBSD beasty.netlab.albury.tafe 7.2-STABLE FreeBSD 7.2-STABLE #4: Thu May  7 13:37:25 EST 2009     root@beasty.netlab.albury.tafe:/usr/obj/usr/src/sys/BEASTY  i386
>Description:
Configuring memory disk devices currently requires that the devices are numbered consecutively from 0 to be actioned during system startup by the mdconfig2 script. The first non-existent device number signals the end of the list.

Subsequent removal of a device from rc.conf requires others to be renumbered to remove any gaps and fstab entries need to be adjusted to match the updated device numbers.

This proposal is to (optionally) use a list to name those devices you want attached at startup.

The current version of the script allows you to specify exactly this behavior:
_mdconfig2_list="md23 md47 md5"
This appears to be an unintended feature, the leading _ suggesting a private variable that isn't meant to be set.

The proposed change introduces a new variable without the leading _ such that the existing behavior is maintained (use devices from 0 upwards until not found) if the setting isn't used. The private variable is still used to build a dynamic list or hold command line arguments.
>How-To-Repeat:

>Fix:
--- /home/bscott/mdconfig2      2009-11-04 14:25:46.000000000 +1100
+++ /etc/rc.d/mdconfig2 2009-11-04 14:28:19.000000000 +1100
@@ -203,14 +203,15 @@
        done
 }
 
+load_rc_config $name
+_mdconfig2_list="${mdconfig2_list}"
+
 _mdconfig2_cmd="$1"
 if [ $# -gt 0 ]; then
         shift
 fi
 [ -n "$*" ] && _mdconfig2_list="$*"
 
-load_rc_config $name
-
 _mdconfig2_unit=0
 if [ -z "${_mdconfig2_list}" ]; then
        while :; do

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->freebsd-rc 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Thu Nov 5 07:23:45 UTC 2009 
Responsible-Changed-Why:  
affects one of the rc scripts. 

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

From: Garrett Cooper <yanegomi@gmail.com>
To: bug-followup@FreeBSD.org, brian@bunyatech.com.au
Cc:  
Subject: Re: conf/140261: [patch] Improve flexibility of mdconfig2 startup script
Date: Mon, 2 Jan 2012 04:02:48 -0800

 Please refer to conf/122477 for a patch that does what you want.
 Thanks,
 -Garrett
>Unformatted:
