thttpd daemon doesn't change to startup-dir pointed in /etc/conf.d/thttpd, ignoring the variable THTTPD_DOCROOT="/var/www/localhost". Actually it uses the root tree as startup-dir. It seems that the init script cannot read the THTTPD_DOCROOT variable properly, dunno why. Reproducible: Always Steps to Reproduce: 1.emerge thttpd 2.start daemon 3.open webpage Actual Results: all my "/" tree is showed in "index of" page. Expected Results: show html file in /var/www/localhost, as pointed in /etc/conf.d/thttpd. even unmerging thttpd, removing all related config files in /etc and reemerging thttpd the result is the same. ------------------------------- /etc/conf.d/thttpd THTTPD_DOCROOT="/var/www/localhost" THTTPD_OPTS="-p 8080 -u nobody -r -i /var/run/thttpd.pid -l /var/log/thttpd.log" ------------------------------- /etc/init.d/thttpd depend() { need net } start() { ebegin "Starting thttpd" if [ ! -d "$THTTPD_DOCROOT" ]; then eend 1 "THTTPD_DOCROOT not set correctly in /etc/conf.d/thttpd" exit 1 fi cd $THTTPD_DOCROOT if [ $? -ne 0 ]; then eend $? "ERROR: cannot change to docroot \"$THTTPD_DOCROOT\"" fi start-stop-daemon --quiet --start --startas /usr/sbin/thttpd \ --pidfile /var/run/thttpd.pid -- ${THTTPD_OPTS} eend $? } stop() { local rc ebegin "Stopping thttpd" start-stop-daemon --quiet --stop --pidfile /var/run/thttpd.pid rc=$? rm -f /var/run/thttpd.pid eend $rc } -------------------------------
To me it appears that this is caused by a change in sys-apps/baselayout # start-stop-daemon --help [...] -C|--chdir <directory> Change to <directory>(default is /) [...] Thus the initscript chdirs to $THTTPD_DOCROOT but then start-stop-daemon ignores the CWD. Two possible solutions: 1. In /etc/init.d/thttpd use: start-stop-daemon -C $THTTPD_DOCROOT or 2. In /etc/conf.d/thttpd append: THTTPD_OPTS="... -d $THTTPD_DOCROOT" tamas
Thank's tamas, dunno how, but i managed to fix it removing all thttpd related files, doing a emerge -u world then reemerging thttpd. I'm suspect that's nothing about thttpd, but something broken with enviroment variables. Anyway thank's for your time.