The mini_httpd-1.17_beta1.ebuild installs a config file in /etc/conf.d/mini_httpd. in this config file one can activate the cgi functionality by activating the following line: MINI_HTTPD_OPTS="$MINI_HTTPD_OPTS -c cgi/*" unfortunately the rc-script /etc/init.d/mini_httpd will expand the given file pattern 'cgi/*' if it matches existing files in the htdocs-directory and so the start-daemon call will fail with a syntax error (wrong options) Reproducible: Always Steps to Reproduce: 1. copy some files into $MINI_HTTPD_DOCROOT/cgi/ 2. remove '#' from the line MINI_HTTPD_OPTS="$MINI_HTTPD_OPTS -c cgi/*" in /etc/conf.d/mini_httpd 3. try to start daemon: /etc/init.d/mini_httpd start Actual Results: the mini_httpd daemon will not start and print the following error message: * Starting mini_httpd... usage: /usr/sbin/mini_httpd [-C configfile] [-D] [-S] [-E certfile] [-Y cipher] [-p port] [-d dir] [-c cgipat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset] [-P P3P] [-M maxage] [ !! ] This is, because the pattern cgi/* expands to the existing filenames in the directory $MINI_HTTPD_DOCROOT/cgi/ and so the option -c of the command line will have too much arguments (all filenames in ../cgi/*) Expected Results: start the daemon Workaround: As far as I can see, the easiest way to solve this bug is to use a config file for mini_httpd instead of command line options. So the content of /etc/conf.d/mini_httpd should be changed to: MINI_HTTPD_OPTS="-C /etc/mini_httpd.conf" and one should use (and the ebuild should install) a /etc/mini_httpd.conf file. (an example config file is provided in /usr/doc/mini_httpd-1.17_beta1/mini_httpd.conf.sample.gz) After that, the daemon will read its configuration from /etc/mini_httpd.conf.
It seems to work for me. 1. the default conf.d/mini_httpd suggests MINI_HTTPD_OPTS="$MINI_HTTPD_OPTS -c **.cgi" resulting in _all_ files ending with .cgi _anywhere_ in your docroot to be handled as cgis. => that works without pattern-expansion of "*" by the shell 2. I changed MINI_HTTPD_OPTS to your line and tested ... that works too: relevant start-line from init-script: start-stop-daemon --quiet --start --startas /usr/sbin/mini_httpd \ --pidfile /var/run/mini_httpd.pid -- ${MINI_HTTPD_OPTS} => startup results in the following: # ps aux | grep mini nobody 21123 0.0 0.1 2608 928 ? S 09:22 0:00 /usr/sbin/mini_httpd -p 80 -u nobody -i /var/run/mini_httpd.pid -l /var/log/mini_httpd.log -c cgi/* Are you 100% sure that there is no quoting-/syntax-error in your conf.d-script? Thomas
Hi Thomas, thanks for testing! If my line works for you, you probably forgot to populate the cgi-directory with some files, which name match the given wildcard? this is my /etc/conf.d/mini_httpd (copy and paste, comment lines deleted): MINI_HTTPD_DOCROOT="/home/httpd/htdocs" MINI_HTTPD_OPTS=" -S -p 8080 -u nobody -i /var/run/mini_httpd.pid -l /var/log/mini_httpd.log" MINI_HTTPD_OPTS="$MINI_HTTPD_OPTS -c cgi/*.cgi" this is the content of the htdoc dir (ls /home/httpd/htdocs): root@t800:root > ls /home/httpd/htdocs/ cgi htdig index.html and this is the content of the cgi dir (ls /home/httpd/htdocs/cgi): root@t800:root > ls /home/httpd/htdocs/cgi/ bla.cgi fasel.cgi x.cgi root@t800:root > in this configuration, the startscript fails: * Starting mini_httpd... usage: /usr/sbin/mini_httpd [-C configfile] [-D] [-S] [-E certfile] [-Y cipher] [-p port] [-d dir] [-c cgipat] [-u user] [-h hostname] [-r] [-v] [-l logfile] [-i pidfile] [-T charset] [-P P3P] [-M maxage] [ !! ] this is, because the command line ist expanded to: + start-stop-daemon --quiet --start --startas /usr/sbin/mini_httpd --pidfile /var/run/mini_httpd.pid -- -S -p 8080 -u nobody -i /var/run/mini_httpd.pid -l /var/log/mini_httpd.log -c cgi/bla.cgi cgi/fasel.cgi cgi/x.cgi (you can see this line, if you add set -x to the script) That should not happen, because the option '-c cgi-bin/*' is taken from the manpage of mini_httpd. I agree, that the pattern '**.cgi' does not raise this error situation, but the start script should be more robust in the case, that someone uses other patterns. Karsten
as you suspected -- I did not populate the cgi-directory, if I do so I get the error you described. trying to preserve the cmd-line-option in conf.d/mini_httpd would lead to a quoting-desert (if it works at all) that isn't less error-prone than the current solution. the only clean solution that comes to my mind is to remove the cmd-line-stuff completely from conf.d/mini_httpd and point the user to the sample-configfile. what do you think?
I would suggest, that the ebuild unpacks /usr/doc/mini_httpd-VERSION/mini_httpd.conf.sample.gz and copy it into /etc/mini_httpd.conf and change the /etc/conf.d/mini_httpd file into: MINI_HTTPD_OPTS="-C /etc/mini_httpd.conf" the provided conf example does exact the same setting, the command line options do now. Karsten
OK, here are 2 suggestions for the gentoo-devs: 1. eliminate the options in conf.d and use a /etc/mini_httpd.conf: --- mini_httpd.init 2003-03-04 07:51:41.000000000 +0100 +++ mini_httpd.init-r1 2003-09-06 17:11:23.000000000 +0200 @@ -18,7 +18,7 @@ eend $? "ERROR: cannot change to docroot \"$MINI_HTTPD_DOCROOT\"" fi start-stop-daemon --quiet --start --startas /usr/sbin/mini_httpd \ - --pidfile /var/run/mini_httpd.pid -- ${MINI_HTTPD_OPTS} + --pidfile /var/run/mini_httpd.pid -- -C /etc/mini_httpd.conf eend $? } --- mini_httpd-1.17_beta1.ebuild 2003-09-06 04:13:23.000000000 +0200 +++ mini_httpd-1.17_beta1-r1.ebuild 2003-09-06 17:13:03.000000000 +0200 @@ -54,12 +54,14 @@ mv ${D}/usr/share/man/man1/{,mini_}htpasswd.1 exeinto /etc/init.d - newexe ${FILESDIR}/mini_httpd.init mini_httpd - insinto /etc/conf.d - newins ${FILESDIR}/mini_httpd.confd mini_httpd - dodoc README ${FILESDIR}/mini_httpd.conf.sample + newexe ${FILESDIR}/mini_httpd.init-r1 mini_httpd + + insinto /etc + newins ${FILESDIR}/mini_httpd.conf.sample mini_httpd.conf + + dodoc README } pkg_postinst() { - ewarn "Adjust MINI_HTTPD_DOCROOT in /etc/conf.d/mini_httpd !" + ewarn "Adjust /etc/mini_httpd.conf!" } 2. add a note to /etc/conf.d/mini_httpd like the following: --- mini_httpd.confd 2003-03-04 07:51:41.000000000 +0100 +++ mini_httpd.confd-r1 2003-09-06 17:16:52.000000000 +0200 @@ -18,5 +18,9 @@ MINI_HTTPD_OPTS="-p 8080 -u nobody -r -i /var/run/mini_httpd.pid -l /var/log/mini_httpd.log" -## to add cgi-support: -#MINI_HTTPD_OPTS="$MINI_HTTPD_OPTS -c **.cgi" +## to add cgi-support you should switch over to a config-file, a sample can +## be found in your DOCDESTTREE (/usr/share/doc/mini_httpd-xxxx) named +## mini_httpd.conf.sample.gz +## copy the sample to /etc/mini_httpd.conf and replace the MINI_HTTPD_OPTS-line +## above by: +##MINI_HTTPD_OPTS="-C /etc/mini_httpd.conf" Personally I would prefer 2. as it's following KISS. Thomas
Thank you Thomas. I would support the KISS principle, too. So suggestion #2 seems to be fine. Karsten
Hi, I've committed the suggested comment changes to the conf.d file. It should appear on your local rsync mirror within the hour. Could you please take a look, and confirm that the changes made are what you need? Thanks, Stu
Perfect -- I think it should be clear enough what to do to get CGIs working. Thanks for adding, Thomas
Excellent - bug closed.
Closing bug - user verified that the fix worked.