From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (X11; U; Linux)
Description of problem:
initlog -c <cmd> (used by daemon() in init.d/functions) runs the specified
command as a child. initlog's event loop waits for the following
- data from the command's stdout
- data from the command's stderr
initlog dies when it receives SIGCHLD.
If the command daemonizes (ie. it fork()s and the parent dies), and then
produces output on stdout or stderr, it gets an error back (either SIGPIPE
or EPIPE, depending on context). Programs that don't ignore SIPIPE and
programs that actually check output streams for errors will die.
Steps to Reproduce:
pxe-0.1-22 (from RH7.1, rebuilt for RH6.2) demonstrates this problem.
Actual Results: It starts happily enough, and dies after it has been used
for a while.
Why is it trying to write to stdout/stderr after it's backgrounded itself?
It sounds like the daemon is broken.
I'm half in agreement with you, and if you want to reassign this bug to the pxe
package then go ahead.
However, I doubt that pxe is unique in that it uses output streams after
daemonizing. The only other example that I can think of right now is xdm (which
RH doesn't start via initlog, thus avoiding this problem), but I would be amazed
if there weren't others too.
The reason I'm not completely convinced that initlog is right to exit is that
some libraries (including libc) occasionally write diagnostic output to stderr.
This output being is the program's control. On most systems, you end up with
output on the console (fairly harmless). With RH, the daemon dies unexpectedly.
A common workaround is for daemons to redirect stdout and stderr to /dev/null,
but delibrately throwing away diagnostic output is rather unhelpful.
Closing out bugs on older, no longer supported, releases.
initlog is no longer in the current devel tree, so it is unlikely to change.