Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 107665 - rc-daemon.sh should correctly use --name (otherwise python daemons don't work)
Summary: rc-daemon.sh should correctly use --name (otherwise python daemons don't work)
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] baselayout (show other bugs)
Hardware: All Linux
: High major (vote)
Assignee: Printing Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 97033
  Show dependency tree
 
Reported: 2005-09-29 20:14 UTC by Alexandre Rostovtsev (RETIRED)
Modified: 2006-01-14 10:49 UTC (History)
5 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Fixes hplip with baselayout-1.12.0 (hpssd.py.patch,200 bytes, patch)
2005-10-06 00:39 UTC, Roy Marples (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Rostovtsev (RETIRED) gentoo-dev 2005-09-29 20:14:19 UTC
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)
Comment 1 Alexandre Rostovtsev (RETIRED) gentoo-dev 2005-09-29 20:48:01 UTC
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.
Comment 2 Roy Marples (RETIRED) gentoo-dev 2005-10-06 00:36:01 UTC
(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.
Comment 3 Roy Marples (RETIRED) gentoo-dev 2005-10-06 00:39:31 UTC
Created attachment 69970 [details, diff]
Fixes hplip with baselayout-1.12.0
Comment 4 Marcelo Goes (RETIRED) gentoo-dev 2006-01-14 10:49:37 UTC
The same fix popped up in bug 98428, it's in 0.9.7-r1. Thanks.