Rkhunter cronjob errors

Saw this in my weekly rkhunter’s run :

/etc/cron.weekly/rkhunter:
/usr/bin/rkhunter: 7439: [: Binary: unexpected operator
/usr/bin/rkhunter: 7439: [: Binary: unexpected operator

Was not the first time, but now I had time to investigate…

So it seems that the problem comes from using non-english locales with Ubuntu’s people reporting they would fix it in the upcoming release 16.04 ! It’s rather sad that people have to wait for several months to get a fix for such a trivial and annoying error.

Luckily I found a post on the rkhunter bugtracker with the fix :

--- a/files/rkhunter
+++ b/files/rkhunter
@@ -7416,7 +7416,7 @@ do_i18n_update() {
                        fi
 
                        if [ -s "${DB_PATH}/i18n/${LANGFILE}" ]; then
-                               PROG_VERS=`grep ${GREP_OPT} '^[Vv]ersion:[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$' "${DB_PATH}/i18n/${LANGFILE}" 2>/dev/null | tail ${TAIL_OPT}1 | cut -d: -f2`
+                               PROG_VERS=`grep ${GREP_OPT} -a '^[Vv]ersion:[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]$' "${DB_PATH}/i18n/${LANGFILE}" 2>/dev/null | tail ${TAIL_OPT}1 | cut -d: -f2`
 
                                if [ -z "${PROG_VERS}" ]; then
                                        PROG_VERS=0

Note the -a option passed to grep to force it to treat the files as ASCII instead of binary format.