git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Alex Riesen <raa.lkml@gmail.com>
Cc: git discussion list <git@vger.kernel.org>,
	Martin F Krafft <madduck@madduck.net>
Subject: Re: git-remote: Use of uninitialized value in string ne, line 248
Date: Wed, 24 Oct 2007 18:48:49 -0700	[thread overview]
Message-ID: <7vr6jk3qwu.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20071024193954.GA5280@steel.home> (Alex Riesen's message of "Wed, 24 Oct 2007 21:39:54 +0200")

Alex Riesen <raa.lkml@gmail.com> writes:

> 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

  parent reply	other threads:[~2007-10-25  1:49 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-24 11:08 git-remote: Use of uninitialized value in string ne, line 248 martin f krafft
2007-10-24 11:49 ` Junio C Hamano
2007-10-24 11:59   ` martin f krafft
2007-10-24 19:39   ` Alex Riesen
2007-10-24 20:27     ` martin f krafft
2007-10-24 20:40       ` Ralf Wildenhues
2007-10-25  1:48     ` Junio C Hamano [this message]
2007-10-24 20:39   ` Pierre Habouzit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vr6jk3qwu.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=madduck@madduck.net \
    --cc=raa.lkml@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).