Re: git-remote: Use of uninitialized value in string ne, line 248
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Oct 25, 2007, 01:48 UTC
- Message-ID
- <7vr6jk3qwu.fsf@gitster.siamese.dyndns.org>
- In-Reply-To
- <20071024193954.GA5280@steel.home>
Alex Riesen <raa.lkml@gmail.com> writes:
Show 18 quoted lines
> Junio C Hamano, Wed, Oct 24, 2007 13:49:51 +0200:
>> Perhaps....
>>
>> git-remote.perl | 3 ++-
>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>
>> diff --git a/git-remote.perl b/git-remote.perl
>> index 9ca3e7e..4cee044 100755
>> --- a/git-remote.perl
>> +++ b/git-remote.perl
>> @@ -244,7 +244,8 @@ sub show_remote {
>> print "* remote $name\n";
>> print " URL: $info->{'URL'}\n";
>> for my $branchname (sort keys %$branch) {
>> - next if ($branch->{$branchname}{'REMOTE'} ne $name);
>> + next if (!$branch->{$branchname}{'REMOTE'} ||
>
> just you never call yor branches "0".Ok, that is about remote name '0' but whatever...
-- >8 -- [PATCH] git-remote: fix "Use of uninitialized value in string ne"
martin f krafft <madduck@madduck.net> writes:
> piper:~> git remote show origin > * remote origin > URL: ssh://git.madduck.net/~/git/etc/mailplate.git > Use of uninitialized value in string ne at /usr/local/stow/git/bin/git-remote line 248.
This is because there might not be branch.<name>.remote defined but the code unconditionally dereferences $branch->{$name}{'REMOTE'} and compares with another string.
Tested-by: Martin F Krafft <madduck@madduck.net> Signed-off-by: Junio C Hamano <gitster@pobox.com> --- git-remote.perl | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/git-remote.perl b/git-remote.perl index 8e2dc4d..11630b1 100755 --- a/git-remote.perl +++ b/git-remote.perl @@ -244,7 +244,8 @@ sub show_remote { print "* remote $name\n"; print " URL: $info->{'URL'}\n"; for my $branchname (sort keys %$branch) { - next if ($branch->{$branchname}{'REMOTE'} ne $name); + next unless (defined $branch->{$branchname}{'REMOTE'} && + $branch->{$branchname}{'REMOTE'} eq $name); my @merged = map { s|^refs/heads/||; $_;
-- 1.5.3.4.1324.ga7925