Package: apticron
Version: 1.1.58
Severity: normal
Tags: upstream patch


-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.3.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_AU.UTF-8, LC_CTYPE=en_AU.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages apticron depends on:
ii  apt                    1.2
ii  bzip2                  1.0.6-8
pn  cron | cron-daemon     <none>
ii  debconf [debconf-2.0]  1.5.58
ii  dpkg                   1.18.4
ii  s-nail [mailx]         14.8.6-1
ii  ucf                    3.0032

Versions of packages apticron recommends:
ii  apt-listchanges  2.85.14
ii  iproute2         4.3.0-1

apticron suggests no packages.

-- debconf information:
  apticron/notification: root

Problem
-------

Currently, for users using s-nail on their systems, apticron mail
reporting is broken. This is also true for apticron's cron reporting
back to the user.

Although apticron does check for the system mailx as being
heirloom-mailx or bsd-mailx, it doesn't check for s-nail correctly. It
relies on 'readlink -e /usr/bin/mailx' to return "heirloom-mailx",
whereas on my sid system it returns "s-nail".

The reporting email is never sent.

Fix
---

The fix is to check specifically for s-nail rather than rely on readlink
to return a reference to s-nail, as currently it returns mailx instead
of s-nail.


How is this a problem?
----------------------

s-nail uses the '-a' parameter differently to previous versions of
mailx.  With previous versions, -a indicated an additional email header
to be included, whereas s-nail uses -a to specify an attachment to be
included with the email.

Since apticron uses -a to set a number of headers, s-nail throws errors
about such as "MIME-Version: 1.0: No such file or directory".
"MIME-Version: 1.0" is meant to be an email header.
--- apticron	2016-01-15 22:16:05.000000000 +0800
+++ /tmp/apticron	2016-01-26 09:25:49.359961187 +0800
@@ -4,7 +4,8 @@
 # implementations in Debian. Make sure we send proper headers, and a
 # text/plain content type.
 Mailx() {
-	if [ "x`readlink -e /usr/bin/mailx`" = "x/usr/bin/heirloom-mailx" ]
+	local MAILER="`readlink -e /usr/bin/mailx`"
+	if [ x$MAILER = "x/usr/bin/heirloom-mailx" -o x$MAILER = "x/usr/bin/s-nail" ]
 	then
 		# heirloom-mailx creates correct headers, but needs help
 		# if the terminal charset (LC_CTYPE) is no UTF-8 locale

Reply via email to