Subject: Re: [PATCH (BUGFIX)] gitweb: Fix "Use of uninitialized value" error in 'history' view

From: Jakub Narebski <[email-masked]>
Date: Sat, 5 Apr 2008 09:09:11 +0100

Junio C Hamano <[email-masked]> wrote:
> Jakub Narebski <[email-masked]> writes:
> 
> > When asked for history of a file with no $hash ('h') parameter set,
> > and which file is not present in current branch ("HEAD" or given by
> > $hash_hase ('hb') parameter), but is present deeper in the full
> > history of a branch, gitweb would spew multiple of "Use of
> > uninitialized value" warnings, and some links would be missing.
> > This commit fixes this bug.
> 
> Thanks, does gitweb itself generate such a link?
> 
> I can _artificially_ reproduce this, and I can also see that the patch
> would solve it, so I do not mind applying it, but I am curious how this
> was originally triggered.

Actually I came across this error when testing the "context-sensitive
feed links" patch, and was hand-crafting (munging) gitweb URLs.

But after thinking about this bug a bit I have realized that this
situation _can_ happen with link generated by gitweb, only in very rare
cases.  It is enough if you use 'history' view link without $hash ('h')
parameter, and with transient $hash_base ('hb') parameter, i.e. either
name of branch, or "HEAD", or not set (implies "HEAD"), and happen into
situation where file was _deleted_ *between* gitweb link creation and
following (accessing) this link.  For example 'history' links in 'tree'
and 'commitdiff' views doesn't have 'h' parameter.  Also the 'history'
link in navigation bar wouldn't have 'h' parameter if 'blob' or 'tree'
view where it is in doesn't have it.

-- 
Jakub Narebski
Poland