FS#16095 - [openvpn] bash error in initscript

Attached to Project: Arch Linux
Opened by Dieter Plaetinck (Dieter_be) - Tuesday, 08 September 2009, 11:26 GMT
Last edited by Thomas Bächler (brain0) - Thursday, 01 October 2009, 15:23 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Thomas Bächler (brain0)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

openvpn-2.1_rc19-2 (latest package from core)

grep '$!' /etc/rc.d/*

/etc/rc.d/openvpn: /usr/sbin/openvpn --daemon --writepid "${STATEDIR}"/"$(basename "${cfg}" .conf)".pid --cd "${CFGDIR}" --config "${cfg}" || success=$!
/etc/rc.d/openvpn-tapdev: /usr/sbin/openvpn --mktun --dev-type tap --dev ${tapdev} >/dev/null 2>&1 || success = $!
/etc/rc.d/openvpn-tapdev: /usr/sbin/openvpn --rmtun --dev-type tap --dev ${tapdev} >/dev/null 2>&1 || success = $!

All of these success variables should be assigned to '$?', not '$!'. (former: exit code of last command, latter: last argument of last command).


Also, /etc/rc.d/openvpn-tapdev has the same problem as /etc/rc.d/openvpn had (http://mailman.archlinux.org/pipermail/arch-commits/2009-July/056937.html): it should be 'success=$?'
This task depends upon

Closed by  Thomas Bächler (brain0)
Thursday, 01 October 2009, 15:23 GMT
Reason for closing:  Fixed
Comment by François Rey (fmjrey) - Wednesday, 16 September 2009, 11:30 GMT
Please fix this script, it's already compromising security, see http://bbs.archlinux.org/viewtopic.php?pid=620370
Comment by Thomas Bächler (brain0) - Monday, 21 September 2009, 22:42 GMT
Ugh, this is bad, I wonder why nobody noticed (works fine here, no idea why).

@fmjrey: Please do not post comments unrelated to the bug report. Also, instead of pointing to a forum thread please describe what the actual problem is.
Comment by Dieter Plaetinck (Dieter_be) - Tuesday, 22 September 2009, 08:35 GMT
okay you fixed the $! -> $? bugs,

but you forgot the 'success = $?' bug @ http://repos.archlinux.org/viewvc.cgi/openvpn/repos/testing-i686/openvpn-tapdev.rc?revision=52629&view=markup
Comment by Thomas Bächler (brain0) - Tuesday, 22 September 2009, 08:55 GMT
Yes, I am the real shit these days :(
Comment by Thomas Bächler (brain0) - Tuesday, 22 September 2009, 16:58 GMT
Now it should be fine. If someone had actually read the script before I released it, this would have gone better.
Comment by Dieter Plaetinck (Dieter_be) - Tuesday, 22 September 2009, 18:34 GMT
you may always ask me to proofread your scripts if you want ^^

Dieter
Comment by Thomas Bächler (brain0) - Tuesday, 22 September 2009, 19:40 GMT
Okay, we can close this when we move it to core - but I don't have any signoffs yet ...

Loading...