From owner-freebsd-rc@FreeBSD.ORG Sat Feb 22 05:20:45 2014 Return-Path: Delivered-To: rc@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id E40BA603; Sat, 22 Feb 2014 05:20:45 +0000 (UTC) Received: from mail.allbsd.org (gatekeeper.allbsd.org [IPv6:2001:2f0:104:e001::32]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8581E11CD; Sat, 22 Feb 2014 05:20:41 +0000 (UTC) Received: from alph.d.allbsd.org (p2106-ipbf2009funabasi.chiba.ocn.ne.jp [114.146.169.106]) (authenticated bits=128) by mail.allbsd.org (8.14.5/8.14.5) with ESMTP id s1M5KJkd015821 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 22 Feb 2014 14:20:29 +0900 (JST) (envelope-from hrs@FreeBSD.org) Received: from localhost (localhost [IPv6:::1]) (authenticated bits=0) by alph.d.allbsd.org (8.14.7/8.14.7) with ESMTP id s1M5KGRm004012; Sat, 22 Feb 2014 14:20:18 +0900 (JST) (envelope-from hrs@FreeBSD.org) Date: Sat, 22 Feb 2014 14:19:35 +0900 (JST) Message-Id: <20140222.141935.520275210006153242.hrs@allbsd.org> To: jhellenthal@dataix.net, dteske@FreeBSD.org Subject: Re: network.subr _aliasN handling From: Hiroki Sato In-Reply-To: <11c101cf2f6b$e3aee5d0$ab0cb170$@FreeBSD.org> References: <7EAEF3AC-DB1B-4D3E-A156-E1E76B765990@jnielsen.net> <11c101cf2f6b$e3aee5d0$ab0cb170$@FreeBSD.org> X-PGPkey-fingerprint: BDB3 443F A5DD B3D0 A530 FFD7 4F2C D3D8 2793 CF2D X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO) Mime-Version: 1.0 Content-Type: Multipart/Signed; protocol="application/pgp-signature"; micalg=pgp-sha1; boundary="--Security_Multipart(Sat_Feb_22_14_19_35_2014_788)--" Content-Transfer-Encoding: 7bit X-Virus-Scanned: clamav-milter 0.97.4 at gatekeeper.allbsd.org X-Virus-Status: Clean X-Greylist: Sender DNS name whitelisted, not delayed by milter-greylist-4.2.7 (mail.allbsd.org [133.31.130.32]); Sat, 22 Feb 2014 14:20:31 +0900 (JST) X-Spam-Status: No, score=-94.3 required=13.0 tests=CONTENT_TYPE_PRESENT, RCVD_IN_PBL,RCVD_IN_RP_RNBL,SPF_SOFTFAIL,USER_IN_WHITELIST autolearn=no version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on gatekeeper.allbsd.org Cc: rc@FreeBSD.org X-BeenThere: freebsd-rc@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "Discussion related to /etc/rc.d design and implementation." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Feb 2014 05:20:46 -0000 ----Security_Multipart(Sat_Feb_22_14_19_35_2014_788)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit wrote in <11c101cf2f6b$e3aee5d0$ab0cb170$@FreeBSD.org>: dt> dt> dt> > -----Original Message----- dt> > From: John Nielsen [mailto:lists@jnielsen.net] dt> > Sent: Friday, February 21, 2014 9:06 AM dt> > To: Devin Teske dt> > Cc: Jason Hellenthal; rc@freebsd.org; net@freebsd.org dt> > Subject: Re: network.subr _aliasN handling dt> > dt> > On Jan 4, 2014, at 4:25 AM, Teske, Devin dt> wrote: dt> > dt> > > On Jan 4, 2014, at 2:59 AM, Jason Hellenthal wrote: dt> > > dt> > >> I believe I know what you mean by that but in a way scares me when dt> you say dt> > sort as in mixing up the original order they appear in which I would dt> find to be dt> > really unattractive to most. dt> > > dt> > > It's not as scary as it sounds. dt> > > dt> > > The issue is that the variables are sorted alphabetically, instead of dt> > > numerically. dt> > > dt> > > Let's take four words: foo1, foo2, foo10, and foo20. dt> > > If you sort them alphabetically, you get: dt> > > dt> > > foo1 dt> > > foo10 dt> > > foo2 dt> > > foo20 dt> > > dt> > > You'll notice this when doing a directory listing, as that too is dt> > > sorted alphabetically. dt> > > dt> > > This is why "alias14" is run before "alias8" and "alias9". Because dt> > > they are processed in alphabetically sorted order. I didn't do dt> > > anything to sort the values, they came pre-sorted in alphabetic order. dt> > > dt> > > If I simply throw in a "| sort -n", then it will change it to dt> numerically sorted. dt> > > As you might expect, numerically sorting the above list would result dt> in: dt> > > dt> > > foo1 dt> > > foo2 dt> > > foo10 dt> > > foo20 dt> > > dt> > > Trivial really. I'll throw a patch at you when I get some cycles dt> (soon). dt> > dt> > Hi Devin, Jason- dt> > dt> > I've been behind on my mailing list e-mail for a while, but I really dt> like the idea dt> > and the patch proposed here. I don't see anything like it in head yet, dt> so ... Ping? dt> > :) dt> > dt> > JN dt> > dt> [Devin Teske] dt> dt> *** this time with attached patch.txt *** dt> dt> Hi JN, here's a new patch that incorporates numerical sorting as well as dt> what dt> the original patch set out to do ... make "gaps" possible (so that you dt> could dt> comment out an alias without having to renumber all the ones following). dt> dt> Give it a look, let me know what you think. +list_vars() +{ + set | { while read LINE; do + var="${LINE%%=*}" + case "$var" in + "$LINE"|*[!a-zA-Z0-9_]*) continue ;; + $1) echo $var + esac + done; } +} This can be inconsistent with normalization of $_if in get_if_var() when [.-/+] is included. I have no strong opinion about fixing the sequence gap issue but ifconfig_IF_aliases was meant for that. This behavior is well-known for a very long time, so I was reluctant to change it. -- Hiroki ----Security_Multipart(Sat_Feb_22_14_19_35_2014_788)-- Content-Type: application/pgp-signature Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEABECAAYFAlMIM2cACgkQTyzT2CeTzy01DACglBRihkVaqZfdhQaN6xg2fWO2 8tkAn1cPDwsR81E64f2eLebORd4YuhJE =7hvi -----END PGP SIGNATURE----- ----Security_Multipart(Sat_Feb_22_14_19_35_2014_788)----