Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
https://wiki.archlinux.org/title/Bug_reporting_guidelines
Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.
REPEAT: Do NOT report bugs for outdated packages!
FS#14428 - [sysvinit-2.86] pidof ignores full pathname (pidof /usr/bin/daemon1 == pidof daemon1)
Attached to Project:
Arch Linux
Opened by Sebastian (sepo) - Wednesday, 22 April 2009, 15:38 GMT
Last edited by Eric Belanger (Snowman) - Wednesday, 06 May 2009, 18:36 GMT
Opened by Sebastian (sepo) - Wednesday, 22 April 2009, 15:38 GMT
Last edited by Eric Belanger (Snowman) - Wednesday, 06 May 2009, 18:36 GMT
|
DetailsDescription:
pidof ignores the full pathname even if the manpage says it doesn't. Since pidof is used in many rc.d scripts this may lead to unwanted misbehavior. PIDOF(8) [...] When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs. [...] Additional info: package version : sysvinit-2.86 debian bug report: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=160329 Steps to reproduce: $ /usr/sbin/daemon1 $ /home/user/daemon1 $ ./daemon1 $ pidof /usr/sbin/daemon1 -> prints the 3 pids of the above programs, but only /usr/sbin/daemon1 should match |
This task depends upon
There is a package "core/psmisc" that includes a "killall", this can work as "pidof" and works better.
The problem is that "killall" are in /usr/bin/ and killall5 in /sbin so, if /usr is in another partition and there are a problem in it...
@Sebastian: try this:
ln -sf /usr/bin/killall /bin/pidof
To restore:
ln -sf ../sbin/killall5 /bin/pidof
For example:
This is with pidof (kilall5) from sysvinit
[djgera@exequiel ~]$ pidof /lalala/agetty
2048 2047 2046 2045 2044
And this with pidof (killall) from psmisc
$ pidof /lalala/agetty
/lalala/agetty: No such file or directory
Nevertheless the sysvini package should be fixed that there is a properly working pidof e.g. after system installation.
I just verified it once again.
If /usr/bin/myscript is a schell script
$ pidof myscript # works, prints the pid
$ pidof /usr/bin/myscript # doesn't work, no pid (the -x option does not exist)
If i reboot with /bin/pidof still linked to /usr/bin/killall i get an error at "Loading standard ACPI modules" (pidof useage is printed) and at "Checking Filesystems" ("/sbin/fsck.xfs: UUID=[...] does not exist" & "Filesystem Check Failed"). Then the bootup scripts are stopping after "Checking Filesystems" and i get a console prompt "Give root password for maintenance".
$ ps aux |grep emacs
eric 14236 0.1 0.5 139024 20936 pts/2 S 19:28 0:00 emacs ChangeLog
eric 15317 5.2 0.5 139052 20748 pts/4 S+ 19:41 0:00 ./emacs
eric 25032 0.0 0.5 140408 22380 pts/1 S 19:04 0:00 emacs PKGBUILD
eric 25610 0.1 0.5 140728 22724 pts/2 S 19:10 0:02 emacs PKGBUILD
$ pidof emacs
25610 25032 15317 14236
$ pidof /usr/bin/emacs
25610 25032 14236
$ pidof /home/eric/emacs
15317
..."Otherwise it is possible that it returns pids of running programs that happen to have the same name as the program you're after but are actually other programs."
$ /bin/sleep 60 &
[1] 9683
$ pidof /no-existe/sleep
9683