From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28805 invoked by alias); 11 Aug 2015 09:52:58 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 36095 Received: (qmail 1415 invoked from network); 11 Aug 2015 09:52:55 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2 autolearn=ham autolearn_force=no version=3.4.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.co.uk; s=s2048; t=1439286442; bh=6v76QeG6zn5KaUbLEDwtJdiYZuMRRLpBv7i5e19QtG4=; h=In-reply-to:From:References:To:Subject:Date:From:Subject; b=GvHagg3v5EcJ6bR3q48HVCeKMOLiYByWscPoal55+7e4ysvvv5wBwp9i3eg7Viz1qoxW0UY7Ns4bEmrDu4RoYM7RGLamJAqNzrBxdp1LY2HOIugzS4+4zMSSkC1OnCmP6oTrr2JassWBj8Mp4wn3qBCkaOa7Q1csLaWRTUdiWGa8koYA8gtO247l6z7KuwDxO8nR3mQ32S1+iIYAGJVtFawG6XOD7gLlm7Gu5GKXcYyTLAXEwxcsPedM5mGZ0khDBEZCf8/rchOBzORpXh2h4EwZIICMS1RE38vXNtCmv+M4S07eXYFpAAdyj+8vpj7GphoFrOjlVjnz1py5YnvMRA== X-Yahoo-Newman-Id: 882414.1944.bm@smtp120.mail.ir2.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: 2b_8cOQVM1k8LgkNlBGreaA10hPN_vArXtlWEaALyU8UaLQ TJ3pcPdi522.UJPGi6AzxZKMBPHV76J5.ToiO.HH2.2GnOt8uQ_P5yfIhKV_ qTRieb0l5d8l3PTmcA2Qm_JuQUgALKks.hZNxbfGHVsu7KSco8OZFzjByotl pCdq0e6YxPoe.JTpRahEP2gaTvVoK7RYzZCk86hzvH7K8V37xqL.xAtV2W70 rwRFLZ7R.LaCgJ4.18qByHQXGxfMYK02hYvNyO19yNgputO8.hXS1R89M93Y 3Y9dFrWBanidS579tK17jLNk.Cq41ng2FMPEPhkK.GrtRfDGPxfyzORX0OOw LkLX4tkZr8K0EyRYB_.hfCLlFyXISsQxU4A4xcpbdieAFSUs1KL9TlgIM9xU mYp1A3zRt4OF_iN7Q6nPQlFKIyrwuA1MScE1HNb6IFsds9IfV2tmC3v4SgcN qu.3yvSmItknxchSfOtp9aRdsMyqEQKoJSh1wTfuRSCDdcEKIfopRRcDDGc5 ZWLgc70buhPU18Bj6aNcOok1v2qEL.g-- X-Yahoo-SMTP: opAkk_CswBAce_kJ3nIPlH80cJI- In-reply-to: <1439254143-4608-1-git-send-email-llua@gmx.com> From: Oliver Kiddle References: <1439254143-4608-1-git-send-email-llua@gmx.com> To: zsh-workers@zsh.org Subject: Re: [PATCH] _find_net_interfaces: use /sys/class/net/* for interface names in linux MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <27318.1439286441.1@thecus.kiddle.eu> Date: Tue, 11 Aug 2015 11:47:21 +0200 Message-ID: <27319.1439286441@thecus.kiddle.eu> Eric Cook wrote: > I also wasn't able to find the type of tunnels mentioned in > http://www.zsh.org/mla/workers/2007/msg00111.html that doesn't show up > in /proc/sys/net/ipv4/conf/. Maybe at some point since then, that was > fixed. But to avoid some kind of regression /sys/class/net/ seems usable > for the time being. One example, is aliases. So if you do something like ifconfig eth0:1 192.168.42.37 then ifconfig will show eth0:1 while /sys/class won't. There may be cases where we don't want to complete those, however. > diff --git a/Completion/Unix/Type/_find_net_interfaces b/Completion/Unix/Type/_find_net_interfaces > index 0c70335..f90f310 100644 > --- a/Completion/Unix/Type/_find_net_interfaces > +++ b/Completion/Unix/Type/_find_net_interfaces > @@ -23,7 +23,7 @@ case $OSTYPE in > irix*) net_intf_list=( ${${${(f)"$(/usr/etc/netstat -i)"}%% *}[2,-1]} ) ;; > *linux*) > if (( $+commands[ip] )); then > - net_intf_list=( ${${(m)${(f)"$(ip -o link)"}#*: }%%: *} ) > + net_intf_list=( /sys/class/net/*(N:t) ) > fi > ;& The (( $+commands[ip] )) isn't really applicable after that change. Also did you notice that we still have the following further down in the function: if [[ -d /proc/sys/net/ipv4/conf ]]; then # On linux we used to use the following as the default. # However, we now use ip or ifconfig since it finds additional devices such # as tunnels. So only do this if that didn't work. net_intf_list=( /proc/sys/net/ipv4/conf/*~*(all|default)(N:t) ) fi I think the /proc path there will work for older Linux installations than the /sys path you use and it still works with new systems. Oliver