lsof-org / lsof

LiSt Open Files
https://lsof.readthedocs.io
Other
414 stars 104 forks source link

[BUG] fd numbers also truncated in -F fd *output for other programs* #311

Open stephane-chazelas opened 6 months ago

stephane-chazelas commented 6 months ago

Describe the bug

I can (sort of) understand the truncation of the fd number (and asterisk alerting about it) in:

$ bash -c 'ulimit -n 20000; exec 12345<> /dev/null; lsof -w -ap "$$" /dev/null; exit'
COMMAND  PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
bash    9385 chazelas *345u   CHR    1,3      0t0    5 /dev/null

Where the FD column has a fixed limited width that hadn't accounted for fds one day possibly be greater than 999 decades ago

But IMO, it doesn't make sense in the output for other programs where there's no reason for the width to be limited:

$ bash -c 'ulimit -n 20000; exec 12345<> /dev/null; lsof -w -F fd -ap "$$" /dev/null; exit'
p9431
f*345

Expected:

$ bash -c 'ulimit -n 20000; exec 12345<> /dev/null; lsof -w -F fd -ap "$$" /dev/null; exit'
p9431
f12345

(reproduced with lsof from Ubuntu 22.04 and current git HEAD (e30113e5eb151a83d7a4d0935f58b6b542ed31eb)).