troglobit/merecat

CGI scripts, specifically cgit

alephnull opened this issue · 6 comments

I am trying to get cgit to be served by merecat and have come up against this bug. I do not fully understand CGI and PATH_INFO but I did track down an old patch for thttpd which seems relevant. However, I cannot figure out if this patch has been applied as it cannot be applied in its current form.

I'd be happy to provide any other information to help debug this.

Hi! What version of Mercat httpd are you using, a released version or the latest master? I've mostly run GitWeb and fixed some CGI issues surrounding that, see http://git.troglobit.com/

The mail thread you linked to look very interesting, I found the "titan" patches¹ which I'll look into when I find the time. There could definitely be more details to look into. The patch itself is however already applied to Merecat, which leads me back to my first question; what version of Merecat are you using?
__
¹) https://marc.info/?l=thttpd&m=108352795820187&w=2

What version of Mercat httpd are you using, a released version or the latest master?

Latest master, built into a debian package. Its running on armhf.

OK, thanks! I think I've reproduced your problem now. Set up a cgit instance on my own server http://cgit.troglobit.com/ ... I'll look into the details over the weekend.

With the following in my /etc/cgitrc, a bit of linking+symlinking, and some magic virtual host bind-mounts, I got it working on my Ubuntu server. Note the leading slash in the virtual-root:*

# cgit config

css=/cgit.css
logo=/cgit.png

# Prepend this to all URLs
virtual-root=/cgit.cgi/

# Home of all GIT repos
scan-path=/srv/git/

# if you do not want that webcrawler (like google) index your site
robots=noindex, nofollow

My /usr/share/cgit is bind mounted into /var/www/cgit.troglobit.com and contains the following files (cgit.cgi is linked from ../../lib/cgit/):

root@example:/usr/share/cgit# ll
total 1000
drwxr-xr-x   2 root root   4096 Mar 30 11:16 ./
drwxr-xr-x 140 root root   4096 Mar 30 09:39 ../
-rwxr-xr-x   2 root root 986800 Feb 12  2016 cgit.cgi*
-rw-r--r--   1 root root  13312 Feb 12  2016 cgit.css
-rw-r--r--   1 root root   1278 Feb 12  2016 cgit.png
-rw-r--r--   1 root root   1078 Feb 12  2016 favicon.ico
lrwxrwxrwx   1 root root     22 Mar 30 11:16 filters -> ../../lib/cgit/filters/
lrwxrwxrwx   1 root root      8 Mar 30 10:16 index.cgi -> cgit.cgi*
-rw-r--r--   1 root root     47 Feb 12  2016 robots.txt

Thanks @troglobit. I tried your config but I could not get it working without vhosts. I cannot setup vhosts at this time but I will sooner or later.

Aha, well that could be that you need to use /var/www/cgi-bin/ for all such purposes, or an issue with chrooting.