lsof icon indicating copy to clipboard operation
lsof copied to clipboard

[BUG] -t | -w suppress warning message, but help text is still shown

Open PeterPitterling opened this issue 1 year ago • 1 comments

Describe the bug -t | -w suppress warning message, but help text is still shown

To Reproduce Steps to reproduce the behavior:

  1. Run 'lsof -t -D /non_existent_folder'
  2. shows helptext

Expected behavior no warning and no help text should be written

Program output

$ lsof +D /test
lsof: WARNING: can't stat(/test): No such file or directory
lsof 4.93.2
 latest revision: https://github.com/lsof-org/lsof
 latest FAQ: https://github.com/lsof-org/lsof/blob/master/00FAQ
 latest (non-formatted) man page: https://github.com/lsof-org/lsof/blob/master/Lsof.8
 usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-E] [+|-e s] [+|-f[gG]]
 [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s]
 [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.

$ lsof -w +D /test
lsof 4.93.2
 latest revision: https://github.com/lsof-org/lsof
 latest FAQ: https://github.com/lsof-org/lsof/blob/master/00FAQ
 latest (non-formatted) man page: https://github.com/lsof-org/lsof/blob/master/Lsof.8
 usage: [-?abhKlnNoOPRtUvVX] [+|-c c] [+|-d s] [+D D] [+|-E] [+|-e s] [+|-f[gG]]
 [-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [+m [m]] [+|-M] [-o [o]] [-p s]
 [+|-r [t]] [-s [p:s]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.

Environment (please complete the following information):

  • Kernel: all
  • OS: all
  • lsof Version: all
  • Origin: all

PeterPitterling avatar Mar 28 '24 12:03 PeterPitterling

I think it is probably a issue of lsof +D /nonexistent printing help text?

jiegec avatar Mar 28 '24 13:03 jiegec