lsof icon indicating copy to clipboard operation
lsof copied to clipboard

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

Open stephane-chazelas opened this issue 1 year ago • 0 comments

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)).

stephane-chazelas avatar Mar 22 '24 07:03 stephane-chazelas