* git-remote: Use of uninitialized value in string ne, line 248
@ 2007-10-24 11:08 martin f krafft
2007-10-24 11:49 ` Junio C Hamano
0 siblings, 1 reply; 8+ messages in thread
From: martin f krafft @ 2007-10-24 11:08 UTC (permalink / raw)
To: git discussion list
[-- Attachment #1: Type: text/plain, Size: 740 bytes --]
I am useless at Perl, otherwise I'd fix this, but I don't know
what's going on, so best I can do is report it. This is against
current tip of master.
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.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Tracked remote branches
master
piper:~> git branch
* master
--
martin | http://madduck.net/ | http://two.sentenc.es/
"... and so he killed Miguel in a rit of fealous jage."
-- inspector clouseau
spamtraps: madduck.bogus@madduck.net
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git-remote: Use of uninitialized value in string ne, line 248
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
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Junio C Hamano @ 2007-10-24 11:49 UTC (permalink / raw)
To: martin f krafft; +Cc: git discussion list
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.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
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'} ||
+ $branch->{$branchname}{'REMOTE'} ne $name);
my @merged = map {
s|^refs/heads/||;
$_;
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: git-remote: Use of uninitialized value in string ne, line 248
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:39 ` Pierre Habouzit
2 siblings, 0 replies; 8+ messages in thread
From: martin f krafft @ 2007-10-24 11:59 UTC (permalink / raw)
To: Junio C Hamano, git discussion list
[-- Attachment #1: Type: text/plain, Size: 520 bytes --]
also sprach Junio C Hamano <gitster@pobox.com> [2007.10.24.1349 +0200]:
> - next if ($branch->{$branchname}{'REMOTE'} ne $name);
> + next if (!$branch->{$branchname}{'REMOTE'} ||
> + $branch->{$branchname}{'REMOTE'} ne $name);
Confirmed: this fixes the issue. Thanks.
--
martin | http://madduck.net/ | http://two.sentenc.es/
"convictions are more dangerous enemies of truth than lies."
- friedrich nietzsche
spamtraps: madduck.bogus@madduck.net
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git-remote: Use of uninitialized value in string ne, line 248
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-25 1:48 ` Junio C Hamano
2007-10-24 20:39 ` Pierre Habouzit
2 siblings, 2 replies; 8+ messages in thread
From: Alex Riesen @ 2007-10-24 19:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git discussion list
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".
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git-remote: Use of uninitialized value in string ne, line 248
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
1 sibling, 1 reply; 8+ messages in thread
From: martin f krafft @ 2007-10-24 20:27 UTC (permalink / raw)
To: Alex Riesen, Junio C Hamano, git discussion list
[-- Attachment #1: Type: text/plain, Size: 726 bytes --]
also sprach Alex Riesen <raa.lkml@gmail.com> [2007.10.24.2139 +0200]:
> just you never call yor branches "0".
Wow, Perl is weird. :)
perl -e 'print "The earth is a disk!\n" if ( "earth" == "flat" );'
Is there a way to make it explicit that you're checking for a value
being defined, where a "false" value would count as true, just as
long as there is a value?
--
martin | http://madduck.net/ | http://two.sentenc.es/
micro$oft dns service terminates abnormally
when it receives a response
to a dns query that was never made.
fix information: run your dns service on a different platform.
-- bugtraq
spamtraps: madduck.bogus@madduck.net
[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git-remote: Use of uninitialized value in string ne, line 248
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:39 ` Pierre Habouzit
2 siblings, 0 replies; 8+ messages in thread
From: Pierre Habouzit @ 2007-10-24 20:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: martin f krafft, git discussion list
[-- Attachment #1: Type: text/plain, Size: 1336 bytes --]
On Wed, Oct 24, 2007 at 11:49:51AM +0000, Junio C Hamano wrote:
> 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.
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>
> 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'} ||
> + $branch->{$branchname}{'REMOTE'} ne $name);
This looks better (wrt the "0" issue raised earlier):
+ next unless (defined($branch->{$branchname}{'REMOTE'}) &&
+ $branch->{$branchname}{'REMOTE'} eq $name);
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git-remote: Use of uninitialized value in string ne, line 248
2007-10-24 20:27 ` martin f krafft
@ 2007-10-24 20:40 ` Ralf Wildenhues
0 siblings, 0 replies; 8+ messages in thread
From: Ralf Wildenhues @ 2007-10-24 20:40 UTC (permalink / raw)
To: martin f krafft; +Cc: Alex Riesen, Junio C Hamano, git discussion list
* martin f krafft wrote on Wed, Oct 24, 2007 at 10:27:24PM CEST:
>
> perl -e 'print "The earth is a disk!\n" if ( "earth" == "flat" );'
Well, numerical equality and string equality are two different things,
try eq instead (see: perldoc perlop).
> Is there a way to make it explicit that you're checking for a value
> being defined, where a "false" value would count as true, just as
> long as there is a value?
Yes. It's called "defined".
perl -e 'my $a=0; print "yes\n" if defined $a;'
It should be used here, to allow "0" branches.
Cheers,
Ralf
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: git-remote: Use of uninitialized value in string ne, line 248
2007-10-24 19:39 ` Alex Riesen
2007-10-24 20:27 ` martin f krafft
@ 2007-10-25 1:48 ` Junio C Hamano
1 sibling, 0 replies; 8+ messages in thread
From: Junio C Hamano @ 2007-10-25 1:48 UTC (permalink / raw)
To: Alex Riesen; +Cc: git discussion list, Martin F Krafft
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-10-25 1:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2007-10-24 20:39 ` Pierre Habouzit
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).