{"thread":{"id":"10450","subject":"git-remote: Use of uninitialized value in string ne, line 248","startedAt":"2007-10-24T11:08:07Z","lastAt":"2007-10-25T01:48:49Z","messageCount":8,"participants":["martin f krafft","Junio C Hamano","Alex Riesen","Pierre Habouzit","Ralf Wildenhues"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"57073","messageId":"20071024110807.GA12501@piper.oerlikon.madduck.net","threadId":"10450","inReplyTo":null,"subject":"git-remote: Use of uninitialized value in string ne, line 248","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2007-10-24T11:08:07Z","receivedAt":"2007-10-24T11:08:07Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"I am useless at Perl, otherwise I'd fix this, but I don't know\nwhat's going on, so best I can do is report it. This is against\ncurrent tip of master.\n\npiper:~> git remote show origin\n* remote origin\n  URL: ssh://git.madduck.net/~/git/etc/mailplate.git\nUse of uninitialized value in string ne at /usr/local/stow/git/bin/git-remote line 248.\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  Tracked remote branches\n    master\npiper:~> git branch\n* master\n\n-- \nmartin | http://madduck.net/ | http://two.sentenc.es/\n \n\"... and so he killed Miguel in a rit of fealous jage.\"\n                                               -- inspector clouseau\n \nspamtraps: madduck.bogus@madduck.net\n"},{"id":"57076","messageId":"7vwstc68bk.fsf@gitster.siamese.dyndns.org","threadId":"10450","inReplyTo":"20071024110807.GA12501@piper.oerlikon.madduck.net","subject":"Re: git-remote: Use of uninitialized value in string ne, line 248","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-24T11:49:51Z","receivedAt":"2007-10-24T11:49:51Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"martin f krafft <madduck@madduck.net> writes:\n\n> piper:~> git remote show origin\n> * remote origin\n>   URL: ssh://git.madduck.net/~/git/etc/mailplate.git\n> Use of uninitialized value in string ne at /usr/local/stow/git/bin/git-remote line 248.\n> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nPerhaps....\n\n git-remote.perl |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-remote.perl b/git-remote.perl\nindex 9ca3e7e..4cee044 100755\n--- a/git-remote.perl\n+++ b/git-remote.perl\n@@ -244,7 +244,8 @@ sub show_remote {\n \tprint \"* remote $name\\n\";\n \tprint \"  URL: $info->{'URL'}\\n\";\n \tfor my $branchname (sort keys %$branch) {\n-\t\tnext if ($branch->{$branchname}{'REMOTE'} ne $name);\n+\t\tnext if (!$branch->{$branchname}{'REMOTE'} ||\n+\t\t\t $branch->{$branchname}{'REMOTE'} ne $name);\n \t\tmy @merged = map {\n \t\t\ts|^refs/heads/||;\n \t\t\t$_;\n"},{"id":"57077","messageId":"20071024115943.GA1016@piper.oerlikon.madduck.net","threadId":"10450","inReplyTo":"7vwstc68bk.fsf@gitster.siamese.dyndns.org","subject":"Re: git-remote: Use of uninitialized value in string ne, line 248","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2007-10-24T11:59:43Z","receivedAt":"2007-10-24T11:59:43Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach Junio C Hamano <gitster@pobox.com> [2007.10.24.1349 +0200]:\n> -\t\tnext if ($branch->{$branchname}{'REMOTE'} ne $name);\n> +\t\tnext if (!$branch->{$branchname}{'REMOTE'} ||\n> +\t\t\t $branch->{$branchname}{'REMOTE'} ne $name);\n\nConfirmed: this fixes the issue. Thanks.\n\n-- \nmartin | http://madduck.net/ | http://two.sentenc.es/\n \n\"convictions are more dangerous enemies of truth than lies.\"\n                                                 - friedrich nietzsche\n \nspamtraps: madduck.bogus@madduck.net\n"},{"id":"57092","messageId":"20071024193954.GA5280@steel.home","threadId":"10450","inReplyTo":"7vwstc68bk.fsf@gitster.siamese.dyndns.org","subject":"Re: git-remote: Use of uninitialized value in string ne, line 248","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2007-10-24T19:39:54Z","receivedAt":"2007-10-24T19:39:54Z","isPatch":false,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"Junio C Hamano, Wed, Oct 24, 2007 13:49:51 +0200:\n> Perhaps....\n> \n>  git-remote.perl |    3 ++-\n>  1 files changed, 2 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-remote.perl b/git-remote.perl\n> index 9ca3e7e..4cee044 100755\n> --- a/git-remote.perl\n> +++ b/git-remote.perl\n> @@ -244,7 +244,8 @@ sub show_remote {\n>  \tprint \"* remote $name\\n\";\n>  \tprint \"  URL: $info->{'URL'}\\n\";\n>  \tfor my $branchname (sort keys %$branch) {\n> -\t\tnext if ($branch->{$branchname}{'REMOTE'} ne $name);\n> +\t\tnext if (!$branch->{$branchname}{'REMOTE'} ||\n\njust you never call yor branches \"0\".\n"},{"id":"57098","messageId":"20071024202724.GA2292@piper.oerlikon.madduck.net","threadId":"10450","inReplyTo":"20071024193954.GA5280@steel.home","subject":"Re: git-remote: Use of uninitialized value in string ne, line 248","fromName":"martin f krafft","fromEmail":"madduck@madduck.net","sentAt":"2007-10-24T20:27:24Z","receivedAt":"2007-10-24T20:27:24Z","isPatch":false,"sender":{"key":"madduck@madduck.net","avatar":null},"body":"also sprach Alex Riesen <raa.lkml@gmail.com> [2007.10.24.2139 +0200]:\n> just you never call yor branches \"0\".\n\nWow, Perl is weird. :)\n\nperl -e 'print \"The earth is a disk!\\n\" if ( \"earth\" == \"flat\" );'\n\nIs there a way to make it explicit that you're checking for a value\nbeing defined, where a \"false\" value would count as true, just as\nlong as there is a value?\n\n-- \nmartin | http://madduck.net/ | http://two.sentenc.es/\n \nmicro$oft dns service terminates abnormally\nwhen it receives a response\nto a dns query that was never made.\nfix information: run your dns service on a different platform.\n                                                            -- bugtraq\n \nspamtraps: madduck.bogus@madduck.net\n"},{"id":"57101","messageId":"20071024203911.GC10900@artemis.corp","threadId":"10450","inReplyTo":"7vwstc68bk.fsf@gitster.siamese.dyndns.org","subject":"Re: git-remote: Use of uninitialized value in string ne, line 248","fromName":"Pierre Habouzit","fromEmail":"madcoder@debian.org","sentAt":"2007-10-24T20:39:11Z","receivedAt":"2007-10-24T20:39:11Z","isPatch":false,"sender":{"key":"madcoder@debian.org","avatar":"https://avatars.githubusercontent.com/u/44708?v=4"},"body":"On Wed, Oct 24, 2007 at 11:49:51AM +0000, Junio C Hamano wrote:\n> martin f krafft <madduck@madduck.net> writes:\n> \n> > piper:~> git remote show origin\n> > * remote origin\n> >   URL: ssh://git.madduck.net/~/git/etc/mailplate.git\n> > Use of uninitialized value in string ne at /usr/local/stow/git/bin/git-remote line 248.\n> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n> \n> Perhaps....\n> \n>  git-remote.perl |    3 ++-\n>  1 files changed, 2 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-remote.perl b/git-remote.perl\n> index 9ca3e7e..4cee044 100755\n> --- a/git-remote.perl\n> +++ b/git-remote.perl\n> @@ -244,7 +244,8 @@ sub show_remote {\n>  \tprint \"* remote $name\\n\";\n>  \tprint \"  URL: $info->{'URL'}\\n\";\n>  \tfor my $branchname (sort keys %$branch) {\n> -\t\tnext if ($branch->{$branchname}{'REMOTE'} ne $name);\n> +\t\tnext if (!$branch->{$branchname}{'REMOTE'} ||\n> +\t\t\t $branch->{$branchname}{'REMOTE'} ne $name);\n\n  This looks better (wrt the \"0\" issue raised earlier):\n\n+\t\tnext unless (defined($branch->{$branchname}{'REMOTE'}) &&\n+\t\t\t $branch->{$branchname}{'REMOTE'} eq $name);\n\n-- \n·O·  Pierre Habouzit\n··O                                                madcoder@debian.org\nOOO                                                http://www.madism.org\n"},{"id":"57102","messageId":"20071024204010.GC15978@ins.uni-bonn.de","threadId":"10450","inReplyTo":"20071024202724.GA2292@piper.oerlikon.madduck.net","subject":"Re: git-remote: Use of uninitialized value in string ne, line 248","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2007-10-24T20:40:11Z","receivedAt":"2007-10-24T20:40:11Z","isPatch":false,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"* martin f krafft wrote on Wed, Oct 24, 2007 at 10:27:24PM CEST:\n> \n> perl -e 'print \"The earth is a disk!\\n\" if ( \"earth\" == \"flat\" );'\n\nWell, numerical equality and string equality are two different things,\ntry eq instead (see: perldoc perlop).\n\n> Is there a way to make it explicit that you're checking for a value\n> being defined, where a \"false\" value would count as true, just as\n> long as there is a value?\n\nYes.  It's called \"defined\".\n  perl -e 'my $a=0; print \"yes\\n\" if defined $a;'\n\nIt should be used here, to allow \"0\" branches.\n\nCheers,\nRalf\n"},{"id":"57121","messageId":"7vr6jk3qwu.fsf@gitster.siamese.dyndns.org","threadId":"10450","inReplyTo":"20071024193954.GA5280@steel.home","subject":"Re: git-remote: Use of uninitialized value in string ne, line 248","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2007-10-25T01:48:49Z","receivedAt":"2007-10-25T01:48:49Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Alex Riesen <raa.lkml@gmail.com> writes:\n\n> Junio C Hamano, Wed, Oct 24, 2007 13:49:51 +0200:\n>> Perhaps....\n>> \n>>  git-remote.perl |    3 ++-\n>>  1 files changed, 2 insertions(+), 1 deletions(-)\n>> \n>> diff --git a/git-remote.perl b/git-remote.perl\n>> index 9ca3e7e..4cee044 100755\n>> --- a/git-remote.perl\n>> +++ b/git-remote.perl\n>> @@ -244,7 +244,8 @@ sub show_remote {\n>>  \tprint \"* remote $name\\n\";\n>>  \tprint \"  URL: $info->{'URL'}\\n\";\n>>  \tfor my $branchname (sort keys %$branch) {\n>> -\t\tnext if ($branch->{$branchname}{'REMOTE'} ne $name);\n>> +\t\tnext if (!$branch->{$branchname}{'REMOTE'} ||\n>\n> just you never call yor branches \"0\".\n\nOk, that is about remote name '0' but whatever...\n\n-- >8 --\n[PATCH] git-remote: fix \"Use of uninitialized value in string ne\"\n\nmartin f krafft <madduck@madduck.net> writes:\n\n> piper:~> git remote show origin\n> * remote origin\n>   URL: ssh://git.madduck.net/~/git/etc/mailplate.git\n> Use of uninitialized value in string ne at /usr/local/stow/git/bin/git-remote line 248.\n\nThis is because there might not be branch.<name>.remote defined but\nthe code unconditionally dereferences $branch->{$name}{'REMOTE'} and\ncompares with another string.\n\nTested-by: Martin F Krafft <madduck@madduck.net>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n git-remote.perl |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\ndiff --git a/git-remote.perl b/git-remote.perl\nindex 8e2dc4d..11630b1 100755\n--- a/git-remote.perl\n+++ b/git-remote.perl\n@@ -244,7 +244,8 @@ sub show_remote {\n \tprint \"* remote $name\\n\";\n \tprint \"  URL: $info->{'URL'}\\n\";\n \tfor my $branchname (sort keys %$branch) {\n-\t\tnext if ($branch->{$branchname}{'REMOTE'} ne $name);\n+\t\tnext unless (defined $branch->{$branchname}{'REMOTE'} &&\n+\t\t\t     $branch->{$branchname}{'REMOTE'} eq $name);\n \t\tmy @merged = map {\n \t\t\ts|^refs/heads/||;\n \t\t\t$_;\n-- \n1.5.3.4.1324.ga7925\n"}]}