00check-network-cable fails with bad variable name

Bug #1397965 reported by Graeme Hewson
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
ifupdown-extra (Ubuntu)
Fix Released
Undecided
Javier Fernández-Sanguino

Bug Description

Running ifup manually with my network configuration gives this error:

# ifup --verbose eth0
Configuring interface eth0=eth0 (inet6)
run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/ethtool
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
modprobe -q net-pf-10 > /dev/null 2>&1 || true # ignore failure.
sysctl -q -e -w net.ipv6.conf.eth0.use_tempaddr=2
sysctl -q -e -w net.ipv6.conf.eth0.accept_ra=2
sysctl -q -e -w net.ipv6.conf.eth0.autoconf=1
ip link set dev eth0 up
run-parts --exit-on-error --verbose /etc/network/if-up.d
run-parts: executing /etc/network/if-up.d/000resolvconf
run-parts: executing /etc/network/if-up.d/00check-network-cable
/etc/network/if-up.d/00check-network-cable: 72: local: detected:: bad variable name
run-parts: /etc/network/if-up.d/00check-network-cable exited with return code 2
Failed to bring up eth0

Running 00check-network-cable with dash -x shows what's happening:

# IFACE=eth0 dash -x 00check-network-cable
+ rc=/etc/default/network-test
+ [ ! -r /etc/default/network-test ]
[snip]
+ check_status_ethtool
+ local status=0
+ grep Link detected
+ /sbin/ethtool eth0
+ local LINK= Link detected: yes
00check-network-cable: 72: local: detected:: bad variable name

The code is saying to define a local variable called "detected:"; this
name comes from the output of the grep in line 72.

The solution is to declare LINK and assign to it in separate steps,
which I do in the attached patch.

I also remove the "true" (:) command from the original:

local LINK=$($ETHTOOL "$IFACE" 2>&1 | grep "Link detected" || :)

because it serves no purpose, as far as I can see.

(See also Debian bug 758798:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=758798 )

Tags: patch
Revision history for this message
Graeme Hewson (ghewson) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "00check-network-cable.patch" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ifupdown-extra (Ubuntu):
status: New → Confirmed
Revision history for this message
Javier Fernández-Sanguino (jfs) wrote :

This bug was fixed in ifupdown-extra version 0.26 (uploaded to Debian in 2016):

Changes:
 ifupdown-extra (0.26) unstable; urgency=medium
 .
(...)
   * if-up-scripts/check-network-cable:
     - Fix the definition of LINK which fails due to variable name
     (Closes: #758798) (LP: 1397965)

Revision history for this message
Javier Fernández-Sanguino (jfs) wrote :

Fixed in version 0.26

Changed in ifupdown-extra (Ubuntu):
assignee: nobody → Javier Fernández-Sanguino (jfs)
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.