Description of problem: rkhunter fails with dash as the /bin/sh shell. It runs fine when running under bash as /bin/sh. /etc/cron.daily/rkhunter: /etc/cron.daily/rkhunter: 22: [: no: unexpected operator dash claims to be a posix compliant shell. Either that is false, or the rkhunter script has a bash-ism that crept in. Version-Release number of selected component (if applicable): bash.x86_64 4.2.47-4.fc20 @koji dash.x86_64 0.5.7-8.fc20 @fedora rkhunter.noarch 1.4.2-2.fc20 @updates How reproducible: always Steps to Reproduce: 1. yum install dash 2. l -l /bin/sh ; cd /bin ; ln -sf dash sh ; ls -l /bin/sh 3. /etc/cron.daily/rkhunter Actual results: an error about a botched [ test. Expected results: no error about a botched [ test. Additional info:
I know of no promise one way or another that rkhunter should work with any posix shell. I've asked upstream to clarify.
The first line is #!/bin/sh which implies it runs on any legit shell. If this isn't the case that line should be changed to #!/bin/bash if it requires bash.
It should not require bash. However, given the variety of shells out there, it may well be that something shell-specific has crept in. We would need to know what line in RKH had failed, so use of 'sh -x' or the RKH '--debug' option will probably be required.
As per the initial bug report description, the line is line 22 of the cron wrapper: /etc/cron.daily/rkhunter: 22: [: no: unexpected operator
Oops. I missed that this was in the cron wrapper. ;( This is something in Fedora, not upstream (that I know of). I'll see what can be done to un-bash it.
I think the bug is that the test uses "==" instead of "=". That is an easy mistake for someone familiar with C to make. diff -uNrp /etc/cron.daily/rkhunter.\~1\~ /etc/cron.daily/rkhunter --- /etc/cron.daily/rkhunter.~1~ 2014-04-06 10:58:43.000000000 -0700 +++ /etc/cron.daily/rkhunter 2014-09-25 16:40:05.507697786 -0700 @@ -19,7 +19,7 @@ if [ ! -e /var/lock/subsys/rkhunter ]; t fi # If a diagnostic mode scan was requested, setup the parameters - if [ "$DIAG_SCAN" == "yes" ]; then + if [ "$DIAG_SCAN" = "yes" ]; then RKHUNTER_FLAGS="--checkall --skip-keypress --nocolors --quiet --appendlog --display-logfile" else RKHUNTER_FLAGS="--cronjob --nocolors --report-warnings-only" Diff finished. Thu Sep 25 16:42:21 2014
Alright, with that change does all work as expected for you?
It looks ok now. There is no gripe for the line 22 test and the rkhunter tests appear to be running correctly.
ok. I can push out an updated package with this change. Did you need it in f20? Or can I just push to rawhide for now and update other branches as needed?
I'm fine with only a rawhide push. Thanks!
Great. Pushed and built in rawhide. ;) Thanks!