Package: debian-goodies
Version: 0.61
Severity: normal
Tags: patch

If checkrestart encounters a service run by an interpreter, and the
interpreter has been upgraded, such as:

    # checkrestart 
    Found 1 processes using old versions of upgraded files
    (1 distinct program)
    (1 distinct packages)
    These processes do not seem to have an associated init script to restart
    them:
    perl-base:
            462     /usr/bin/perl

where:

    # ps auxw|grep 462
    root       462  0.0  0.0   9044  5484 ?        Ss   Nov29   0:54 
/usr/sbin/munin-node

and:

    # ls -l /proc/462/exe
    lrwxrwxrwx 1 root root 0 29. Nov 13:56 /proc/462/exe -> /usr/bin/perl 
(deleted)

then checkrestart will not be able to correctly deal with that service,
since its regex for matching the interpreter:

    self.program = os.readlink('/proc/%d/exe' % self.pid)
    m = re.match("^/usr/bin/(perl|python)$", self.program)

will fail due to the terminating '$' in the regex - note that the link above
contains a "(deleted)" at its end.

If we match the optional " (deleted)" at the end of the line then checkrestart
works as intended:

    m = re.match("^/usr/bin/(perl|python)( \(deleted\))*$", self.program)

Patch is attached.

Thanks,
*t

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)

Kernel: Linux 3.7.0 (SMP w/8 CPU cores)
Locale: LANG=de_CH.UTF-8, LC_CTYPE=de_CH.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages debian-goodies depends on:
ii  curl                      7.26.0-1
ii  dctrl-tools [grep-dctrl]  2.22.2
ii  perl                      5.14.2-15
ii  python                    2.7.3~rc2-1
ii  whiptail                  0.52.14-10

Versions of packages debian-goodies recommends:
ii  lsof  4.86+dfsg-1

Versions of packages debian-goodies suggests:
ii  popularity-contest  1.56
ii  xdg-utils           1.1.0~rc1+git20111210-6
ii  zenity              3.4.0-2

-- no debconf information
diff --git a/checkrestart b/checkrestart
index 382e997..bf672f8 100755
--- a/checkrestart
+++ b/checkrestart
@@ -526,7 +526,7 @@ class Process:
             self.program = os.readlink('/proc/%d/exe' % self.pid)
             # if the executable command is an interpreter such as perl/python,
             # we want to find the real program
-            m = re.match("^/usr/bin/(perl|python)$", self.program)
+            m = re.match("^/usr/bin/(perl|python)( \(deleted\))*$", self.program)
             if m:
                 with open('/proc/%d/cmdline' % self.pid, 'r') as cmdline:
                     # only match program in /usr (ex.: /usr/sbin/smokeping)

Reply via email to