Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#13238 - [netcfg] PRE_DOWN/POST_DOWN stops loading profile

Attached to Project: Arch Linux
Opened by Nick Martin (nijm) - Thursday, 12 February 2009, 12:28 GMT
Last edited by James Rayner (iphitus) - Saturday, 06 June 2009, 01:45 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To James Rayner (iphitus)
Architecture All
Severity Low
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

Adding either of the following lines (or lines like them) prevents bringing up/down network profiles:
POST_DOWN="/bin/bash -c '/bin/kill `/bin/pidof vpnc`'"
PRE_DOWN="/bin/bash -c '/bin/kill `/bin/pidof vpnc`'"

Removing these lines results in being able to bring up/down the network profile.

Additional info:
* package version(s) : 2.1.2-1
* config files:

/etc/network.d/university:

CONNECTION="wireless"
DESCRIPTION="University Wireless"
INTERFACE=eth1
SCAN="yes"
SECURITY="none"
ESSID="University of Manchester"
KEY=""
IP="dhcp"
POST_UP="/usr/local/sbin/vpnc university &>/dev/null"
POST_DOWN="/bin/bash -c '/bin/kill `/bin/pidof vpnc`'"

Steps to reproduce:
Add a PRE_DOWN/POST_DOWN to your network profile, then:

netcfg <profile_name>
netcfg -a
This task depends upon

Closed by  James Rayner (iphitus)
Saturday, 06 June 2009, 01:45 GMT
Reason for closing:  Fixed
Comment by Jan de Groot (JGC) - Thursday, 12 February 2009, 15:04 GMT
This is because netcfg is written in bash and your command with backticks are evaluated at startup of netcfg. When netcfg is started, `/bin/pidof vpnc` returns an empty line.

[jan@jan ~]$ export POST_DOWN="/bin/bash -c '/bin/kill `/bin/pidof vpnc`'"
[jan@jan ~]$ echo $POST_DOWN
/bin/bash -c '/bin/kill '
[jan@jan ~]$ $POST_DOWN
': -c: line 0: unexpected EOF while looking for matching `''
': -c: line 1: syntax error: unexpected end of file

Because of the syntax error, netcfg will abort.
Comment by Aaron Griffin (phrakture) - Friday, 13 February 2009, 19:21 GMT
As JGC pointed out - try using single quotes instead of double quotes around your settings
Comment by David Vilar (davvil) - Saturday, 11 April 2009, 22:00 GMT
I think this is not the main issue (at least not the only one). I have a similar setup:

[...]
POST_UP="vpnc uni-dsl"
PRE_DOWN="vpnc-disconnect"

When I change from a profile without vpnc to one with vpnc like shown above, I get this result:
:: profileWithVPN up [BUSY]
:: profileWithoutVPN down [BUSY]
no vpnc found running

and it does not connect. Inspecting the code, I think this is because the new profile (with vpn) gets already loaded when checking if it exists, setting the PRE_DOWN variable. Then the old one (without vpn) gets unloaded, but WITHOUT unsetting the PRE_DOWN variable. This causes the vpnc-disconnect to be run and fail. Running first "netcfg -a" and then a netcfg with the new profile works.
Comment by James Rayner (iphitus) - Tuesday, 28 April 2009, 10:26 GMT
ok. netcfg in git should not experience this as profiles are all loaded such that options from one will not contaminate another.

Loading...