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 infra@gentoo.org 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
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: No maintainer - Look at https://wiki.gentoo.org/wiki/Project:Proxy_Maintainers if you want to take care of it
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
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: ---


Attachments

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 server.pid-file 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
LIGHTTPD_PID="/var/run/lighttpd.pid"

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/lighttpd.pid~spider{

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 lighttpd.pid; but then /etc/init.d/lighttpd status looks at /var/run/lighttpd.pid~spider{ 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/^[^#]*server.pid-file[[:space:]]*=[[:space:]]*\"\([^"]*\)\"/\1/p' ${LIGHTTPD_CONF})"