This applies to baselayout-1.12.0_pre8-r2 -- I don't know if earlier versions are similarly affected. start-stop-daemon provides the --exec argument for the file to execute, and the --name argument for the name of the process to kill. Unfortunately, the bash wrapper around start-stop-daemon, rc-daemon.sh, ignores the --name argument entirely. This is BAD, because for script daemons, the name of the process does not match the name of the file executed, which totally borks functions like is_daemon_running(). In other words: --start-stop-daemon --exec /usr/bin/foo.py --name 'python /usr/bin/foo.py' should cause rc-daemon.sh to execute /usr/bin/foo.py, but look for 'python /usr/bin/foo.py' in the list of processes. Instead, it looks for /usr/bin/foo.py, and fails. Reproducible: Always Steps to Reproduce: 1. emerge =baselayout-1.12.0_pre8-r2 2. emerge hplip (or any other program using a python daemon) 3. /etc/init.d/hplip start (or any other python, perl, tcl etc. daemon) Actual Results: hpssd.py (or another scripting daemon) fails to start Expected Results: properly start hpssd.py (or other scripting daemon)
Actually -- what is the point of rc-daemon.sh ? It mostly appears to duplicate the existing functionality of start-stop-daemon, while introducing bugs like this one. Considering that start-stop-daemon is written in C, which is the language of the gods, while rc-daemon.sh is in bash, which is slow and bug-prone, it seems that the best solution might be to deprecate rc-daemon.sh entirely.
(In reply to comment #1) > Actually -- what is the point of rc-daemon.sh ? To add extra functionality over start-stop-daemon - basically it's a wrapper. We also enforce stricter checks - we fail with invalid calling whereas start-stop-daemon has unpredictable behaviour but still works. Basically we enforce the man page. > It mostly appears to duplicate > the existing functionality of start-stop-daemon, while introducing bugs like > this one. It has introduced some bugs, and it has fixed others - namely daemons which claim to start whereas they don't or do start, spawn daemons and then bail due to a invalid config/compile and don't clean up these rogue daemons (asterisk, ntp, many others) It also stopped daemons more efficiently (infact it doesn't even call start-stop-daemon for this) > Considering that start-stop-daemon is written in C, which is the > language of the gods, while rc-daemon.sh is in bash, which is slow and > bug-prone, it seems that the best solution might be to deprecate rc-daemon.sh > entirely. A proficient developer can write code that has less bugs and is faster in bash than a novice developer in C. Language choice does not mean faster code ;) This error is either caused by pidof not worning with scripts that starts with #!/bin/env python or #!/usr/bin/env python Actually these could be perl or bash scripts - they would also fail.
Created attachment 69970 [details, diff] Fixes hplip with baselayout-1.12.0
The same fix popped up in bug 98428, it's in 0.9.7-r1. Thanks.