Package: needrestart
Version: 2.7-1
Severity: normal
Tags: patch
Hi,
there is a bashism in /etc/needrestart/notify.d/600-mail (which has a
"#!/bin/sh" shebang line):
$ checkbashisms /etc/needrestart/notify.d/600-mail
possible bashism in /etc/needrestart/notify.d/600-mail line 25 (alternative
test command ([[ foo ]] should be [ foo ])):
if [[ "$NR_NOTIFYD_DISABLE_MAIL" -eq '1' ]]; then
This prevents $NR_NOTIFYD_DISABLE_MAIL from working (if /bin/sh is
e.g. a dash) and hence you can't disable that needrestart sends mails
about processes with outdated libraries being loaded. (Which can be
annoying. ;-)
The following patch fixes this:
--- /etc/needrestart/notify.d/600-mail~ 2016-03-10 19:40:25.000000000 +0100
+++ /etc/needrestart/notify.d/600-mail 2016-05-13 15:12:57.071704687 +0200
@@ -22,7 +22,7 @@
. /usr/lib/needrestart/notify.d.sh
-if [[ "$NR_NOTIFYD_DISABLE_MAIL" -eq '1' ]]; then
+if [ "$NR_NOTIFYD_DISABLE_MAIL" -eq '1' ]; then
echo "[$0] disabled in global config" 1>&2
exit 1
fi
-- System Information:
Debian Release: stretch/sid
APT prefers unstable
APT policy: (990, 'unstable'), (600, 'testing'), (500, 'unstable-debug'),
(500, 'buildd-unstable'), (110, 'experimental'), (1, 'experimental-debug'), (1,
'buildd-experimental')
Architecture: amd64 (x86_64)
Kernel: Linux 4.6.0-rc7-amd64 (SMP w/8 CPU cores)
Locale: LANG=C.UTF-8, LC_CTYPE=C.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
Versions of packages needrestart depends on:
ii dpkg 1.18.7
ii gettext-base 0.19.7-2
ii libintl-perl 1.24-1
ii libmodule-find-perl 0.13-1
ii libmodule-scandeps-perl 1.21-1
ii libproc-processtable-perl 0.53-1+b1
ii libsort-naturally-perl 1.03-1
ii libterm-readkey-perl 2.33-1+b1
ii perl 5.22.2-1
ii xz-utils 5.1.1alpha+20120614-2.1
needrestart recommends no packages.
Versions of packages needrestart suggests:
ii libnotify-bin 0.7.6-2
ii needrestart-session 0.3-2
-- Configuration Files:
/etc/needrestart/notify.conf changed:
NR_NOTIFYD_DISABLE_MAIL='1'
/etc/needrestart/notify.d/600-mail changed:
MAILX='/usr/bin/mail'
test -x "$MAILX" || exit 1
. /usr/lib/needrestart/notify.d.sh
if [ "$NR_NOTIFYD_DISABLE_MAIL" -eq '1' ]; then
echo "[$0] disabled in global config" 1>&2
exit 1
fi
NR_USERID=`id -u "$NR_USERNAME"`
if [ "0$NR_USERID" -gt 0 -a "0$NR_USERID" -lt 1000 ]; then
echo "[$0] do not notify system-user $NR_USERNAME via mail" 1>&2
exit 1
fi
echo "[$0] notify user $NR_USERNAME on $NR_SESSION via mail" 1>&2
{
_NR_FQDN=$(hostname -f)
eval_gettext 'Your session on host $_NR_FQDN ($NR_SESSION) is running
obsolete binaries or libraries as listed below.'
echo
echo
gettext "Please consider a relogin or restart of the affected processes!"
echo
echo
cat
} | fold -s -w 72 | "$MAILX" -s "Relogin or restarts on host $(hostname)
required!" "$NR_USERNAME"
-- no debconf information