Package: lsof
Version: 4.91+dfsg-1
Severity: normal

Dear Maintainer,

By modifying the process name (e.g. by assigning to `$0` in perl as per
below), lsof sometimes fails to see the process even when their PID is
specified directly with `-p`.

Compare a working case:

  $ perl -E '$0 = "changed"; print "My PID is $$\n"; <STDIN>'
  My PID is 4200

  $ lsof -p 4200
  COMMAND  PID USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
  changed 4200  leo  cwd    DIR  254,3    20480 3293185 /home/leo
  changed 4200  leo  rtd    DIR  254,0     4096       2 /
  ...

With a non-working one:

  $ perl -E '$0 = "with-hyphen (and paren)"; print "My PID is $$\n"; <STDIN>'
  My PID is 4748

  $ lsof -p 4748

  $ lsof -p 4748 -V
  lsof: process ID not located: 4748

So far I don't have a conclusive pattern to which modifications are OK
and which cause it to fail. All of these work fine:

  $0 = "a really long name goes here with some stuff"
  $0 = "with(paren)"
  $0 = "with (paren) and spaces"
  $0 = "with-(paren)"
  $0 = "(a b)"
  $0 = "(a b c d e f g)"

This does not

  $0 = "(a b c d e f g h)"

It seems somehow to be related to what's inside the parentheses in the
process name, but I don't know if it's length, or word count, or what
set of characters are present. But then

  $0 = "(and paren)"

on its own *does* work, when it didn't work with the original example
when it suffixed longer text.

Hopefully, these test cases will help mean something to the lsof
developers who might be able to narrow down what is going on.

-- System Information:
Debian Release: 10.0
  APT prefers testing
  APT policy: (990, 'testing'), (500, 'unstable-debug'), (500,
'testing-debug'), (500, 'unstable') Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.19.0-5-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8),
LANGUAGE=en_GB:en (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages lsof depends on:
ii  libc6        2.28-10
ii  libselinux1  2.8-1+b1

lsof recommends no packages.

Versions of packages lsof suggests:
ii  perl  5.28.1-6

-- no debconf information


-- 
Paul "LeoNerd" Evans

leon...@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Reply via email to