Bug#1033311: sysvinit-utils: pidof not always returning a, pid, when using the full path to a program

Jesse Smith jessefrgsmith at yahoo.ca
Thu Mar 23 14:08:37 GMT 2023


> The patched version still fails to find a running vi process when run as
> 
>  pidof $(which vi)
> 
> Is that because there are 2 layers of symlinks?
> 
>  /usr/bin/vi ->  /etc/alternatives/vi ->  /usr/bin/vim.basic



Yes, that would definitely fail. An alias or nested symlinks will
effectively dodge detection from pidof. If ($which vi) resolves to a
symlink, which points to a symlink, which points to a binary then pidof
can't make that many hops. You'd need to use "pidof vim.basic" or "pidof
/usr/bin/vim.basic" the process.

Or alternatively you could just link /usr/bin/vi to /usr/bin/vim.basic
and then use "pidof $(which vi)".



More information about the Debian-init-diversity mailing list