Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bugzilla DB migration completed. Please report issues to Infra team via email via or IRC
Bug 626688 - www-servers/lighttpd: pid file parser in /etc/init.d/lighttpd buggy
Summary: www-servers/lighttpd: pid file parser in /etc/init.d/lighttpd buggy
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at if you want to take care of it
Depends on:
Reported: 2017-07-31 09:41 UTC by Markus Osterhoff
Modified: 2020-09-07 18:45 UTC (History)
3 users (show)

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


Note You need to log in before you can comment on or make changes to this bug.
Description Markus Osterhoff 2017-07-31 09:41:07 UTC
/etc/init.d/lighttpd tries to parse the from /etc/lighttpd/lighttpd.conf using the line

LIGHTTPD_PID="$(grep pid ${LIGHTTPD_CONF} | cut -d '=' -f 2 | tr -d \\\" | tr -d [:space:])"

This results in two problems. First, the LIGHTTPD_PID is also configured in /etc/conf.d/lighttpd as

Then, the parser for the /etc/lighttpd/lighttpd.conf fails if any other line contains "pid", as in this case:

        $HTTP["useragent"] =~ "spider" {
                accesslog.filename   = "/var/www/foo/logs/robots.log"

spider contains pid, and so LIGHTTPD_PID is set to /var/run/{

This filename is then written out to /run/openrc/daemons/lighttpd/001. Since lighttpd itself uses /etc/lighttpd/lighttpd.conf, the actual PID is written to; but then /etc/init.d/lighttpd status looks at /var/run/{ and hence reports the wrong status "crashed".

(1) Is there a reason why the value from /etc/conf.d/lighttpd is overwritten? If not, the parser from /etc/init.d/lighttpd could be dropped.

If yes:
(2) This would be a saner option:
LIGHTTPD_PID="$(sed -n 's/^[^#]*[[:space:]]*=[[:space:]]*\"\([^"]*\)\"/\1/p' ${LIGHTTPD_CONF})"