Skip to content

[BUG] (deleted) flag doesn't take in consideration symlink #331

@henri9813

Description

@henri9813

Describe the bug
(deleted) flag has false-postifi when related to a symlink

To Reproduce

  1. Have /sbin symlink to /usr/sbin
  2. Run a process /usr/sbin/NetworkManager
  3. run lsof |grep "(deleted)"

Network manager is considered "deleted" whereas the file is present.

Expected behavior
The file should not be considered as deleted

Program output
If applicable, paste program output text here to help explain your problem.

[root@gvo-1023 ~]# ls -lsah /
total 24K
   0 dr-xr-xr-x.  18 root root  235 Nov 29 16:36 .
   0 dr-xr-xr-x.  18 root root  235 Nov 29 16:36 ..
   0 dr-xr-xr-x.   2 root root    6 Nov  3 02:29 afs
   0 lrwxrwxrwx.   1 root root    7 Nov  3 02:29 bin -> usr/bin
4.0K dr-xr-xr-x.   5 root root 4.0K Mar 27 11:57 boot
   0 drwxr-xr-x.  21 root root 3.4K Nov 29 16:45 dev
 12K drwxr-xr-x.  96 root root 8.0K Mar 28 14:43 etc
   0 drwxr-xr-x.   4 root root   35 Nov  3 02:29 home
   0 lrwxrwxrwx.   1 root root    7 Nov  3 02:29 lib -> usr/lib
   0 lrwxrwxrwx.   1 root root    9 Nov  3 02:29 lib64 -> usr/lib64
   0 drwxr-xr-x.   2 root root    6 Nov  3 02:29 media
   0 drwxr-xr-x.   2 root root    6 Nov  3 02:29 mnt
   0 drwxr-xr-x.   4 root root   35 Nov  3 02:29 opt
   0 dr-xr-xr-x. 239 root root    0 Nov 29 16:44 proc
4.0K dr-xr-x---.   8 root root 4.0K Mar 31 10:51 root
   0 drwxr-xr-x.  31 root root  980 Mar 31 01:00 run
   0 lrwxrwxrwx.   1 root root    8 Nov  3 02:29 sbin -> usr/sbin
   0 drwxr-xr-x.   2 root root    6 Nov  3 02:29 srv
   0 dr-xr-xr-x.  13 root root    0 Nov 29 16:45 sys
4.0K drwxrwxrwt.  11 root root 4.0K Mar 31 10:51 tmp
   0 drwxr-xr-x.  12 root root  144 Nov 29 16:36 usr
   0 drwxr-xr-x.  20 root root  275 Nov 29 16:45 var
[root@gvo-1023 ~]# ls -lsah /usr/sbin/NetworkManager 
3.7M -rwxr-xr-x. 1 root root 3.6M Mar 18 14:22 /usr/sbin/NetworkManager

[root@gvo-1023 ~]# lsof |grep "(deleted)" |grep "NetworkManager"
NetworkMa     759                                      root  txt       REG              253,0   3769344     472722 /usr/sbin/NetworkManager (deleted)
NetworkMa     759     788 gmain                        root  txt       REG              253,0   3769344     472722 /usr/sbin/NetworkManager (deleted)
NetworkMa     759     789 gdbus                        root  txt       REG              253,0   3769344     472722 /usr/sbin/NetworkManager (deleted)

Environment (please complete the following information):

  • Kernel: Linux 5.14.0-503.15.1.el9_5.x86_64
  • OS: Rocky Linux 9
  • lsof Version: 4.94.0
  • Origin: installed by dnf

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions