Subject: Re: gitweb: (potential) problems with new installation

From: Ramsay Jones <[email-masked]>
Date: Mon, 05 Mar 2012 19:39:48 +0000

Jakub Narebski wrote:
> Do you use CGI (mod_cgi or mod_cgid), or mod_perl?

mod_cgid although mod_perl is also available (and *is* used by git-instaweb).

>>> You can move to using "AddHandler cgi-script .cgi" instead.
>> I remember having tried that as well - without success.
> 
> This must be done _instead_ of ScriptAlias directive and/or ExecCGI option.

Indeed :-D

I had another quick look at this and (I now remember) the AddHandler approach
actually *did* work. However, I already had some other (perl, shell) scripts
in cgi-bin and would have had to add file extensions ('.pl' or '.sh') in order
for them to keep working.

The relevant part of httpd.conf looks like this:

<Directory /var/www/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
        # This directive allows us to have apache2's default start page
        # in /apache2-default/, but still have / go to the right place
        #RedirectMatch ^/$ /apache2-default/
</Directory>

ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
       Options +ExecCGI
</Directory>
<Directory "/var/www/cgi-bin/static">
       Options -ExecCGI
</Directory>

#<Directory "/var/www/cgi-bin">
#        Options +ExecCGI
#        AddHandler cgi-script .cgi .pl .sh
#</Directory>

Note that the "/var/www/cgi-bin/static" directory entry *should* have solved
the problem, but it does not make any difference at all!

BTW, the error.log entries look like:

[Sun Mar 04 15:06:03 2012] [error] (13)Permission denied: exec of '/var/www/cgi-bin/static/gitweb.css' failed
[Sun Mar 04 15:06:03 2012] [error] [client 127.0.0.1] Premature end of script headers: gitweb.css, referer: http://localhost/cgi-bin/gitweb.cgi

with similar entries for git-logo.png and gitweb.js. The access log show
"500 Internal Server error" responses for gitweb.css, git-logo.png and gitweb.js.

Maybe I should re-visit the decision and swap over to using the AddHadler
approach - adding file extensions is not that hard! ;-)

Anyway, the above should work as-is, and I'm somewhat puzzled that it doesn't.
However, as I said before, it's not a gitweb fault.

>>> Could you at minimum check for JavaScript errors using JavaScript Console
>>> (clearing it and reloading gitweb page if needed)?  Please provide line
>>> where error is with a bit of context (around 3 lines).
>> I don't have a JavaScript Console. (I suppose that is an add-on? Hmm, I don't
>> have internet access from Linux... ).
> 
> JavaScript Console is built in, though there are plugins like Console^2
> that extend it.
> 
> In Mozilla 1.7.12 it is "Tools > Web Development > JavaScript Console"
> It is "Tools > Errors Console" or "Tools > Web Console" in modern Firefox.

Ah, OK. I thought you meant something other than the "Error Console".
In that case, *no* javascript errors appear in the error console.

ATB,
Ramsay Jones