git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Fwd: Gitweb error

From
Jakub Narebski <jnareb@gmail.com>
Date
Jan 29, 2012, 00:37 UTC
Message-ID
<201201290137.17556.jnareb@gmail.com>
In-Reply-To
<CA+EqV8w5qz+iwg_PPB4M5Q-LS48B=yncR9UdR-r58BLtAEPPrA@mail.gmail.com>
On Fri, 27 Jan 2012, rajesh boyapati wrote:
> On Fri, Jan 27, 2012 at 3:39 PM, Jakub Narebski <jnareb@gmail.com> wrote:
> > rajesh boyapati <boyapatisrajesh@gmail.com> writes:
Show 6 quoted lines
> > > When I go to one of the projects in gerrit through gitweb and when I
> > > click "summary", I am getting the below error.
> > > If I click other tabs(log, shortlog, commit, tree,etc) after clicking
> > > "summary", I am getting following error in error-log.
> > > If I click other tabs(log, shortlog, commit, tree,etc) before clicking
> > > "summary", everything works fine.

It is strange that you get an intermittent error like this, and make it even harder to debug - HTTP is stateless.

Show 22 quoted lines
> > > Error:
> > > =================================================================
> > > [2012-01-25 18:50:32,334] ERROR
> > > com.google.gerrit.httpd.gitweb.GitWebServlet : CGI: [Wed Jan 25
> > > 18:50:32 2012] gitweb.cgi: Use of uninitialized value $head in string
> > > eq at /usr/lib/cgi-bin/gitweb.cgi line 4720.
> >
> > Could you show this line and about 3 lines of context in your
> > gitweb.cgi?
> >
> 
>     my $alternate = 1;
>     for (my $i = $from; $i <= $to; $i++) {
>         my $entry = $headlist->[$i];
>         my %ref = %$entry;
>         my $curr = $ref{'id'} eq $head;
>         if ($alternate) {
>             print "<tr class=\"dark\">\n";
>         } else {
>             print "<tr class=\"light\">\n";
>         }
>         $alternate ^= 1;
 
Hmmmm... I see that we do not check if $head is defined here before using
it.  This can happen legitimately if we are on yet to be born orphan branch
(so $head, which should be named $head_at, is undefined) but there exist
other branches (so $headlist is not empty).
But I don't think it is what happened in your case, is it?
[...]
-- 
Jakub Narebski
Poland
Previous: Jakub NarebskiNext: Jakub Narebski
Message 3 of 14 in “Fwd: Git-web error”
  1. rajesh boyapatiJan 27, 2012
  2. Jakub NarebskiJan 27, 2012
  3. Jakub NarebskiJan 29, 2012
  4. Jakub NarebskiJan 30, 2012
  5. gitweb: Deal with HEAD pointing to unborn branch in "heads" viewJakub Narebski, Feb 3, 2012
  6. Jakub NarebskiFeb 7, 2012
  7. gitweb: Harden parse_commit and parse_commitsJakub Narebski, Feb 8, 2012
  8. Jakub NarebskiFeb 9, 2012
  9. gitweb: Silence stderr in parse_commit*() subroutinesJakub Narebski, Feb 11, 2012
  10. Junio C HamanoFeb 13, 2012
  11. Jakub NarebskiFeb 13, 2012
  12. Jakub NarebskiFeb 13, 2012
  13. Jakub NarebskiFeb 13, 2012
  14. Jakub NarebskiFeb 15, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.