Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 260151 - [QA] net-proxy/dante dante-sockd-init has bashism
Summary: [QA] net-proxy/dante dante-sockd-init has bashism
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Gentoo Network Proxy Developers (OBSOLETE)
URL:
Whiteboard:
Keywords: QAcanfix
Depends on:
Blocks:
 
Reported: 2009-02-24 17:18 UTC by Timothy Redaelli (RETIRED)
Modified: 2009-03-05 19:32 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Timothy Redaelli (RETIRED) gentoo-dev 2009-02-24 17:18:54 UTC
drizzt@ITVIMN0I35793 dante % checkbashisms.pl -f files/dante-sockd-init
possible bashism in files/dante-sockd-init line 25 (should be >word 2>&1):
        /usr/sbin/sockd -V &> /tmp/dante-sockd.checkconf
possible bashism in files/dante-sockd-init line 47 (should be >word 2>&1):
                --make-pidfile --exec /usr/sbin/sockd -- ${SOCKD_OPT} &> /dev/null
drizzt@ITVIMN0I35793 dante %
Comment 1 Alin Năstac (RETIRED) gentoo-dev 2009-02-28 09:54:48 UTC
Fixed in dante-1.1.19-r3.
Comment 2 Martin von Gagern 2009-03-05 14:58:18 UTC
Short version: please change "2>&1 >file" to ">file 2>&1".

Long version: http://sources.gentoo.org/viewcvs.py/gentoo-x86/net-proxy/dante/files/dante-sockd-init?r1=1.4&r2=1.5 changes "&> file" to "2>&1 >file" which is probably incorrect. "&> file" redirects both standard output and standard error to the target file, while "2>&1 >file" redirects standard error to what previously was standard output, and standard output only to the file. As a result, error messages from the process will not end up in the file, but on standard output. To get the behaviour of "&> file" you should use ">file 2>&1", i.e. change the order. That way, you will redirect standard output to the file first, and then redirect standard error to what standard output is currently pointing to, i.e. the same file.

To test this on the command line:
$ ( echo error 1>&2 ) 2>&1 >/dev/null
error
$ ( echo error 1>&2 ) >/dev/null 2>&1
Comment 3 Alin Năstac (RETIRED) gentoo-dev 2009-03-05 19:32:55 UTC
Damn shell language! 
Fixed in in dante-1.1.19-r4, thanks for pointing out my mistake.