[pkg-lighttpd] Bug#446324: lighttpd: stderr not closed

Olaf van der Spek Olaf at XWIS.Net
Tue Oct 30 11:59:24 UTC 2007


Michal Čihař wrote:
> I can reproduce it only in postinst (the code is actually already in
> phpmyadmin package, just the debconf option for lighttpd is not there
> as it would break).
> 
> After some more testing it seems that some interaction between debconf
> and lighttpd causes this. You can reproduce it by following script:
> 
> #!/bin/sh
> . /usr/share/debconf/confmodule
> invoke-rc.d lighttpd reload
> 
> The "fix" for this seems to be to use 
> 
> invoke-rc.d lighttpd reload 3>/dev/null 
> 
> however I don't know why this fixes it, at it looks to me more like a
> workaround than a fix to me :-).

I think it's related to this code:
# Only do this once.
if [ -z "$DEBCONF_REDIR" ]; then
         # Redirect standard output to standard error. This prevents common
         # mistakes by making all the output of the postinst or whatever
         # script is using this library not be parsed as confmodule 
commands.
         #
         # To actually send something to standard output, send it to fd 3.
         exec 3>&1
         if [ "$DEBCONF_USE_CDEBCONF" ]; then
                 exec 1>&5
         else
                 exec 1>&2
         fi
         DEBCONF_REDIR=1
         export DEBCONF_REDIR
fi

My guess is that this code is opening fd 3 (stdout is fd 1, stderr is fd 
2) and not closing it. Then Lighttpd inherits fd 3 and doesn't close it 
either. I've no idea who is supposed to close it though.





More information about the pkg-lighttpd-maintainers mailing list