amavisd-new throws stderr when running cron job
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
amavisd-new (Ubuntu) |
Fix Released
|
Low
|
Sergio Durigan Junior |
Bug Description
- Ubuntu 14.04.2 LTS
- amavisd-new 1:2.7.1-2ubuntu3
/etc/cron.
```
#
# SpamAssassin maintenance for amavisd-new
#
# m h dom mon dow user command
18 */3 * * * amavis test -e /usr/sbin/
24 1 * * * amavis test -e /usr/sbin/
```
The contents of `/usr/sbin/
```
if ! perl -MMail:
\$spamtest-
then
#bayes is disabled - just exit
exit
fi
case $1 in
sa-sync)
;;
sa-clean)
;;
*)
;;
esac
```
There are 2 problems here:
1. It throws a stderr message at the first time running:
```
bash -x /usr/sbin/
+ test -e /usr/bin/sa-learn
+ test -e /usr/sbin/
++ id --name -u
+ '[' amavis '!=' amavis ']'
+ set -e
+ umask 022
+ perl -MMail:
$spamtest-
config: created user preferences file: /var/lib/
+ case $1 in
+ /usr/bin/sa-learn --sync
+ exit 0
```
This should be silent as it's run in a cron job.
2. To redirect both stdout and stderr to /dev/null, the redirection order should `>/dev/null 2>&1` instead of `2>&1 >/dev/null` (this one just redirects stdout).
We apologize for taking so long to reply to this bug. While it can be said to a a low priority/wishlist bug, it should have been dealt with sooner. Sorry about this.
The second part of your report has been fixed a while ago and doesn't impact amavisd-new anymore. The first part, however, is still valid. I took the liberty to submit a Merge Request against the amavisd-new Debian package, and once accepted this fix will make its way into the next Ubuntu release.
https:/ /salsa. debian. org/debian/ amavisd- new/-/merge_ requests/ 5
Thanks.