Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 639672 - app-admin/syslog-ng-3.12.1 - QA Notice: shell script appears to use non-POSIX feature(s)
Summary: app-admin/syslog-ng-3.12.1 - QA Notice: shell script appears to use non-POSIX...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Patrice Clement
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-12-03 21:03 UTC by eroen
Modified: 2017-12-06 04:37 UTC (History)
3 users (show)

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


Attachments
app-admin/syslog-ng-3.12.1:20171203-204910.log (syslog-ng-3.12.1:20171203-204910.log,690.25 KB, text/plain)
2017-12-03 21:03 UTC, eroen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description eroen 2017-12-03 21:03:57 UTC
Created attachment 507952 [details]
app-admin/syslog-ng-3.12.1:20171203-204910.log

* Messages for package app-admin/syslog-ng-3.12.1:
 * Log file: /var/log/portage/build/app-admin/syslog-ng-3.12.1:20171203-204910.log

 * For detailed documentation please see the upstream website:
 * https://www.balabit.com/sites/default/files/documents/syslog-ng-ose-3.12-guides/en/syslog-ng-ose-v3.12-guide-admin/html/index.html
 * QA Notice: shell script appears to use non-POSIX feature(s):
 *    possible bashism in /etc/init.d/syslog-ng line 49 (alternative test command ([[ foo ]] should be [ foo ])):
 *    	[[ "$RC_CMD" == "restart" ]] && sleep 1
 *    possible bashism in /etc/init.d/syslog-ng line 49 (should be 'b = a'):
 *    	[[ "$RC_CMD" == "restart" ]] && sleep 1
Comment 1 dwfreed 2017-12-04 00:22:16 UTC
Ironically, the pull request had this right and monsieurp changed it when committing.  Assigning to him to fix (since nobody added a maintainer).
Comment 2 kfm 2017-12-04 00:43:36 UTC
Further, the new runscript completely breaks the assignment of default variable values. I commented on this at bug #592920. Between that and the bashism reported here, there are no other changes. Therefore, I would suggest jettisoning the new runscript altogether and continuing to use the one that currently resides at "$FILESDIR/3.7/syslog-ng.rc6".
Comment 3 Larry the Git Cow gentoo-dev 2017-12-04 00:45:50 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dd18ea8355ebfd3a657958a3989587274ab6813c

commit dd18ea8355ebfd3a657958a3989587274ab6813c
Author:     Patrice Clement <monsieurp@gentoo.org>
AuthorDate: 2017-12-04 00:44:56 +0000
Commit:     Patrice Clement <monsieurp@gentoo.org>
CommitDate: 2017-12-04 00:44:56 +0000

    app-admin/syslog-ng: fix QA warning.
    
    Closes: https://bugs.gentoo.org/639672
    Package-Manager: Portage-2.3.13, Repoman-2.3.3

 app-admin/syslog-ng/files/3.12/syslog-ng.rc | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
Comment 4 kfm 2017-12-04 01:03:49 UTC
Thanks Patrice, but while the commit addresses the improper assignment syntax, it doesn't actually fix the QA warning that is the topic of this bug, which is a distinct issue. If you were to fix the line that eroen mentions, that would be the end of it. Specifically, change this:

  [[ "$RC_CMD" == "restart" ]] && sleep 1

... to this:

  [ "$RC_CMD" = "restart" ] && sleep 1

Yes, == is also a bashism. For more info, I can warmly recommend http://mywiki.wooledge.org/Bashism and https://www.shellcheck.net/.
Comment 5 Larry the Git Cow gentoo-dev 2017-12-04 08:35:04 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=73eb9782813b4e604f66d4334d1f73e97c0f9aa9

commit 73eb9782813b4e604f66d4334d1f73e97c0f9aa9
Author:     Patrice Clement <monsieurp@gentoo.org>
AuthorDate: 2017-12-04 08:34:47 +0000
Commit:     Patrice Clement <monsieurp@gentoo.org>
CommitDate: 2017-12-04 08:34:47 +0000

    app-admin/syslog-ng: remove bashism.
    
    Bug: https://bugs.gentoo.org/639672
    Package-Manager: Portage-2.3.13, Repoman-2.3.3

 app-admin/syslog-ng/files/3.12/syslog-ng.rc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)}
Comment 6 Patrice Clement gentoo-dev 2017-12-04 08:37:57 UTC
Sorry about that btw. I really thought I was doing the right thing. :(
Comment 7 Patrice Clement gentoo-dev 2017-12-04 09:43:52 UTC
We're testing with Tomas and it turns out the following statement isn't actually a bash-ism per se:
: $var

but:
[[ $foo == "bar" ]]

is.

So my assumption was correct except for the [[ ]] which I knew is a bash-ism and shouldn't have written. We'll fix that (again) in the next version bump of syslog-ng.
Comment 8 Tomáš Mózes 2017-12-04 10:45:48 UTC
Thank you guys for the input and Patrice for fixing it. I believe we should have a good and working syslog-ng in portage.

Patrice, everybody makes mistakes, thank you for your quick actions by reverting it to a working state. It's only good you wanted to make it better, well, it's a testing version, so breakage occurs sometimes :)
Comment 9 kfm 2017-12-04 11:02:34 UTC
Indeed, `:` is not a bashism. As an outsider, I'm curious as to whether anyone (or repoman) claimed that it was. Ihe shell grammar, a "simple command" requires that the assignments be declared prior to the word that is interpreted as the command - or builtin - to be executed.

As I mentioned in the other bug, to induce assignment in any other context requires the use of a form of parameter expansion that has this specific characteristic. This is just as true of sh as it is of bash, and they both support the ${parameter:=word} method, if that's what you want. My feeling, for what it is worth, is that this technique is sufficiently obscure that it should be avoided. The main thing is that the the code functions as intended.

In any case, thank you for updating syslog-ng!
Comment 10 Branko Grubic 2017-12-05 18:59:31 UTC
Thank you for fixing this!

I don't know what the rules are, but I guess you should bump the release (-rN) next time (maybe I'm wrong), in my case I don't reboot often, also I use portage snapshots, and after reboot I saw that service failed to start, but on other ~amd64 box it worked fine, I did work around it by uncommenting variables in /etc/conf.d/syslog-ng, but later I tried to investigate since both systems have same version of syslog-ng, and I found that init script was different, then I reinstalled problematic syslong-ng and it was fine which was weird, then I looked at portage tree git log and found this change ( dd18ea8355ebfd3a657958a3989587274ab6813c ).

Or maybe it's my fault not seeing QA notices, not sure if '--quiet-build' affects displaying those?
Comment 11 Tomáš Mózes 2017-12-06 04:37:25 UTC
Probably it just happened too quickly and thus we forgot to revbump. I agree it would have been a cleaner solution as it wasn't a build time failure.