FUN WITH LINUX

Debian Squidguard: update-squidguard does not work with tabs in config-file

18 December 2016

I experienced an interesting problem: on a Debian Jessie host with squidguard: update-squidguard threw the following error-message:

root@34697f9f06a2:/# update-squidguard 
/usr/sbin/update-squidguard: 69: test: dbhome: unexpected operator
Rebuild SquidGuard database - this can take a while.

On Debian Wheezy it returns with the following error:

root@34697f9f06a2:/# update-squidguard 
/usr/sbin/update-squidguard: 95: /usr/sbin/update-squidguard: cannot create dbhome	/var/lib/squidguard/db/../dbversion: Directory nonexistent

The admin configured tabs instead of whitespaces in the following line of his squidguard.conf:

dbhome	/var/lib/squidguard/db

Even if squidguard accepts tabs, update-squidguard does not and apt-get upgrade would not work if squidguard would be upgraded because it calls update-squidguard. The problem seems to be in /usr/sbin/update-squidguard at the following line:

DATADIR=$(grep ^dbhome ${CONFDIR}/${CONFFILE} | cut -d' ' -f2)

This could be easily fixed by using the following code:

DATADIR=$(grep ^dbhome ${CONFDIR}/${CONFFILE} | sed 's/\t/ /' | cut -d' ' -f2)

This would make update-squidguard more robust. I wrote the maintainer, but since it is recommended to use whitespaces he might not fix this.

[ Linux  Sysadmin  Debian  ]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution 3.0 Unported License.

Copyright 2015-present Hoti