Bug#657614: exim4-base: Exim daily cronjob fails when /usr/bin/mail is heirloom-mailx
Andrew Findlay
andrew.findlay at skills-1st.co.uk
Fri Jan 27 11:53:10 UTC 2012
Package: exim4-base
Version: 4.72-6+squeeze2
Severity: normal
Tags: patch
/etc/cron.daily/exim4-base sends out an email containing the daily report.
The command that it uses to do this does not work when heirloom-mailx is in use
as /usr/bin/mail. The Subject option is given after the recipient address and has
no space between '-s' and the subject string.
This needs fixing in two places in the script.
-- Package-specific info:
Exim version 4.72 #1 built 12-May-2011 18:51:33
Copyright (c) University of Cambridge, 1995 - 2007
Berkeley DB: Berkeley DB 4.8.30: (April 9, 2010)
Support for: crypteq iconv() IPv6 PAM Perl Expand_dlfunc GnuTLS move_frozen_messages Content_Scanning DKIM Old_Demime
Lookups: lsearch wildlsearch nwildlsearch iplsearch cdb dbm dbmnz dnsdb dsearch ldap ldapdn ldapm mysql nis nis0 passwd pgsql sqlite
Authenticators: cram_md5 cyrus_sasl dovecot plaintext spa
Routers: accept dnslookup ipliteral iplookup manualroute queryprogram redirect
Transports: appendfile/maildir/mailstore/mbx autoreply lmtp pipe smtp
Fixed never_users: 0
Size of off_t: 8
GnuTLS compile-time version: 2.8.6
GnuTLS runtime version: 2.8.6
Configuration file is /etc/exim4/exim4.conf
-- System Information:
Debian Release: 6.0.3
APT prefers stable
APT policy: (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-xen-amd64 (SMP w/2 CPU cores)
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/dash
Versions of packages exim4-base depends on:
ii adduser 3.112+nmu2 add and remove users and groups
ii cron 3.0pl1-116 process scheduling daemon
ii debconf [debconf-2.0] 1.5.36.1 Debian configuration management sy
ii exim4-config [exim4-con 4.72-6+squeeze2 configuration for the Exim MTA (v4
ii libc6 2.11.2-10 Embedded GNU C Library: Shared lib
ii libdb4.8 4.8.30-2 Berkeley v4.8 Database Libraries [
ii lsb-base 3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip
ii netbase 4.45 Basic TCP/IP networking system
Versions of packages exim4-base recommends:
ii heirloom-mailx [mailx] 12.4-2 feature-rich BSD mail(1)
ii perl-modules 5.10.1-17squeeze2 Core Perl modules
ii psmisc 22.11-1 utilities that use the proc file s
Versions of packages exim4-base suggests:
pn exim4-doc-html | exim4 <none> (no description available)
pn eximon4 <none> (no description available)
ii file 5.04-5 Determines file type using "magic"
ii mutt [mail-reader] 1.5.20-9+squeeze1 text-based mailreader supporting M
ii openssl 0.9.8o-4squeeze7 Secure Socket Layer (SSL) binary a
pn spf-tools-perl <none> (no description available)
pn swaks <none> (no description available)
-- Configuration Files:
/etc/cron.daily/exim4-base changed:
if [ -n "$EX4DEBUG" ]; then
echo "now debugging $0 $@"
set -x
fi
E4BCD_DAILY_REPORT_TO=""
E4BCD_DAILY_REPORT_OPTIONS=""
E4BCD_WATCH_PANICLOG="yes"
E4BCD_PANICLOG_LINES="10"
E4BCD_PANICLOG_NOISE=""
if [ ! -x /usr/lib/exim4/exim4 ]; then
exit 0
fi
[ -f /etc/default/exim4 ] && . /etc/default/exim4
SPOOLDIR="$(exim4 -bP spool_directory | sed 's/.*=[[:space:]]\(.*\)/\1/')"
E4BCD_MAINLOG_NOISE="^[[:digit:][:space:]:-]\{20\}\(\(Start\|End\) queue run: pid=[[:digit:]]\+\|exim [[:digit:]\.]\+ daemon started: pid=[[:digit:]]\+, .*\)$"
if [ -n "$E4BCD_DAILY_REPORT_TO" ]; then
if [ -x "$(command -v eximstats)" ] && [ -x "$(command -v mail)" ]; then
if [ "$(< /var/log/exim4/mainlog grep -v "$E4BCD_MAINLOG_NOISE" | wc -l)" -gt "0" ]; then
< /var/log/exim4/mainlog grep -v "$E4BCD_MAINLOG_NOISE" \
| eximstats $E4BCD_DAILY_REPORT_OPTIONS \
| mail -s "$(hostname --fqdn) Daily e-mail activity report" $E4BCD_DAILY_REPORT_TO
else
echo "no mail activity in this interval" \
| mail -s "$(hostname --fqdn) Daily e-mail activity report" $E4BCD_DAILY_REPORT_TO
fi
else
echo "The exim4 cron job is configured to send a daily report, but eximstats"
echo "and/or mail cannot be found. Please check and make sure that these two"
echo "binaries are available"
fi
fi
log_this() {
TEXT="$@"
if ! logger -t exim4 -p mail.alert $TEXT; then
RET="$?"
echo >&2 "ALERT: could not syslog $TEXT, logger return value $RET"
fi
}
if [ "$E4BCD_WATCH_PANICLOG" != "no" ]; then
if [ -s "/var/log/exim4/paniclog" ]; then
if [ -x "/usr/local/lib/exim4/nonzero_paniclog_hook" ]; then
/usr/local/lib/exim4/nonzero_paniclog_hook
fi
if [ -z "$E4BCD_PANICLOG_NOISE" ] || grep -vq "$E4BCD_PANICLOG_NOISE" /var/log/exim4/paniclog; then
log_this "ALERT: exim paniclog /var/log/exim4/paniclog has non-zero size, mail system possibly broken"
if ! printf "Subject: exim paniclog on %s has non-zero size\nTo: root\n\nexim paniclog /var/log/exim4/paniclog on %s has non-zero size, mail system might be broken. The last ${E4BCD_PANICLOG_LINES} lines are quoted below.\n\n%s\n" \
"$(hostname --fqdn)" "$(hostname --fqdn)" \
"$(tail -n "${E4BCD_PANICLOG_LINES}" /var/log/exim4/paniclog)" \
| exim4 root; then
log_this "PANIC: sending out e-mail warning has failed, exim has non-zero return code"
fi
if [ "$E4BCD_WATCH_PANICLOG" = "once" ]; then
logrotate -f /etc/logrotate.d/exim4-paniclog
fi
fi
fi
fi
if [ -x /usr/sbin/exim_tidydb ]; then
cd $SPOOLDIR/db || exit 1
if ! find $SPOOLDIR/db -maxdepth 1 -name '*.lockfile' -or -name 'log.*' \
-or -type f -printf '%f\0' | \
xargs -0r -n 1 \
start-stop-daemon --start --exec /usr/sbin/exim_tidydb \
--chuid Debian-exim:Debian-exim -- $SPOOLDIR > /dev/null; then
# if we reach this, invoking exim_tidydb from start-stop-daemon has
# failed, most probably because of libpam-tmpdir being in use
# (see #373786 and #376165)
find $SPOOLDIR/db -maxdepth 1 -name '*.lockfile' -or -name 'log.*' \
-or -type f -printf '%f\0' | \
su - --shell /bin/bash \
--command "xargs -0r -n 1 /usr/sbin/exim_tidydb $SPOOLDIR > /dev/null" \
Debian-exim
fi
fi
/etc/logrotate.d/exim4-base changed:
/var/log/exim4/mainlog /var/log/exim4/rejectlog {
daily
missingok
rotate 10
compress
delaycompress
notifempty
create 644 Debian-exim adm
}
-- debconf information excluded
-------------- next part --------------
--- exim4-base.squeeze 2012-01-27 11:47:41.881560547 +0000
+++ exim4-base 2012-01-27 11:48:56.433561299 +0000
@@ -43,10 +43,10 @@
if [ "$(< /var/log/exim4/mainlog grep -v "$E4BCD_MAINLOG_NOISE" | wc -l)" -gt "0" ]; then
< /var/log/exim4/mainlog grep -v "$E4BCD_MAINLOG_NOISE" \
| eximstats $E4BCD_DAILY_REPORT_OPTIONS \
- | mail $E4BCD_DAILY_REPORT_TO -s"$(hostname --fqdn) Daily e-mail activity report"
+ | mail -s "$(hostname --fqdn) Daily e-mail activity report" $E4BCD_DAILY_REPORT_TO
else
echo "no mail activity in this interval" \
- | mail $E4BCD_DAILY_REPORT_TO -s"$(hostname --fqdn) Daily e-mail activity report"
+ | mail -s "$(hostname --fqdn) Daily e-mail activity report" $E4BCD_DAILY_REPORT_TO
fi
else
echo "The exim4 cron job is configured to send a daily report, but eximstats"
More information about the Pkg-exim4-maintainers
mailing list