Package: ifupdown
Version: 0.7
Severity: normal

I have just noticed these error messages that appear during the boot
on my system:

Configuring network interfaces...cat: /sys/class/net/tun0/operstate: No such 
file or directory
cat: /sys/class/net/tap1/operstate: No such file or directory

This is caused by the test

[ -e "/sys/class/net/$iface" -a "$(cat /sys/class/net/$iface/operstate)" = up ]

This will not work as intended because shell evaluates the command
substitution $(...) before running the test command (the "[" command).

Instead, this should be done like this

[ -e "/sys/class/net/$iface" ] && [ "$(cat /sys/class/net/$iface/operstate)" = 
up ]

A patch is attached.

-- 
Stanislav
--- networking.orig	2012-05-30 19:46:14.000000000 +0400
+++ networking	2012-06-19 12:13:23.000000000 +0400
@@ -80,7 +80,7 @@
     then
 	    ifaces=$(for iface in $(ifquery --list --allow=hotplug)
 			    do
-				    if [ -e "/sys/class/net/$iface" -a "$(cat /sys/class/net/$iface/operstate)" = up ]
+				    if [ -e "/sys/class/net/$iface" ] && [ "$(cat /sys/class/net/$iface/operstate)" = up ]
 				    then
 					    echo "$iface"
 				    fi

Reply via email to