My current understanding is that two changes both broke checkrestart;
lsof and dpkg.  As previously noted, searching for ".dpkg-new"
inhibits nearly all output.

I mailed the lsof upstream author.  The lsof change was intentional,
and the author considers the old behavior of listing link counts of 0
buggy (since that information can't be known).  lsof reads the
/proc/*/map files; the relevant information here are the last 3
columns: device, inode and pathname.  The link count is known only if
lsof can do a successful stat() on those pathnames, and if the device
and inode match that found in the map file.  If the stat fails with,
say, ENOENT, then the file could have been rename()d or remove()d; in
the general case, one can't asssume that the link count is zero.  If
the stat succeeds, but the (device, inode) pair doesn't match, the
file still could have been either rename()d or remove()d, following
replacement of that pathname with a new file.

If the link count is not known, then it simply uses a blank entry in
lsof +L, and no output in lsof +L1, which (also) explains why
checkrestart outputs nothing, since deleted or updated files are
precisely what it is trying to find :)

Note that /proc/*/exe, for example, are not "normal" symlinks, but
rather special links which actually point to the real file being
executed, even if it was removed since being executed (which explains
why lsof occasionally has *some* output).

So the output of lsof +L1 has just something like:

  . deleted file descriptors (ls -l /proc/*/fd |grep ' (deleted)$'
  . deleted executables (head -1 /proc/*/maps/; compare inodes with
    stat or stat -L /proc/*/exe and compare)
  . other deleted maps (grep ' (deleted)$' /proc/*/maps)

It will *not* show:

  . all deleted shared libraries; (lsof |grep -E '(path inode=[0-9]+)')
    Since there is no /proc/ file to lstat to obtain the link count

The solution, I think, is to run lsof, and report every opened
pathname for which the (device, inode) pair resulting from stating
that pathname fails to match the pair known to lsof, *or* for which
the stat fails.

I am still confused about the ".dpkg-new" check; could you please
comment on it?

If you like, I will work on patching checkrestart.  If so, let me know
your preference for patching the present implementation, or starting
from scratch, and trying to maintain a similar interface.

Justin


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to