Re: [PATCH (BUGFIX)] gitweb: Fix "Use of uninitialized value" error in 'history' view
- From
Jakub Narebski <jnareb@gmail.com>
- Date
- Apr 5, 2008, 17:16 UTC
- Message-ID
- <200804051916.14568.jnareb@gmail.com>
- In-Reply-To
- <20080405164303.30566.qmail@47fa24fd520dbf.315fe32.mid.smarden.org>
On Sat, 5 Apr 2008, Gerrit Pape wrote:
> On Fri, Apr 04, 2008 at 03:23:42PM +0100, Jakub Narebski wrote:
Show 16 quoted lines
> > 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.
> >
> > This bug occurs in the rare cases when "git log -- <path>" is empty
> > and "git log --full-history -- <path>" is not. Gitweb tried to get
> > file type (it means if it is 'tree' or 'blob' or even 'commit', as
> > 'history' view is for single path which can be any of given types)
> > from the commit we start searching from, and not among found commits.
>
> Do you know whether this fixes http://bugs.debian.org/469083 too? I
> took a short look back then to fix it, but didn't manage it in a
> reasonable amount of time.No it does not.
I have found what causes this bug. When adding is_deleted() subroutine I have forgot about old/legacy URL support[1], where gitweb doesn't have enough information to get raw diff info, and gitweb has to generate required info itself, i.e. the part in git_blobdiff(), around
# old/legacy style URI
if (!%diffinfo && # if new style URI failed
defined $hash && defined $hash_parent) {
# fake git-diff-tree raw output
$diffinfo{'from_mode'} = $diffinfo{'to_mode'} = "blob";
$diffinfo{'from_id'} = $hash_parent;
$diffinfo{'to_id'} = $hash;This code does not, and cannot, fill 'status_str' ('status' is faked). I'd send in a bit patch fixing this bug (making is_deleted() more robust).
Footnotes:
==========
[1] Note that example URL in http://bugs.debian.org/469083 does not
have 'hpb' ($hash_parent_base) parameter set... and that is what
causes this bug.P.S. Gerrit, are you maintainer of git-core debian package?
-- Jakub Narebski Poland