{"thread":{"id":"11535","subject":"Odd number of elements in anonymous hash","startedAt":"2008-01-08T16:38:56Z","lastAt":"2008-01-24T23:10:02Z","messageCount":18,"participants":["Dennis Schridde","Junio C Hamano","Eric Wong","Björn Steinbrink","Sam Vilain"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"64750","messageId":"200801081738.56624.devurandom@gmx.net","threadId":"11535","inReplyTo":null,"subject":"Odd number of elements in anonymous hash","fromName":"Dennis Schridde","fromEmail":"devurandom@gmx.net","sentAt":"2008-01-08T16:38:56Z","receivedAt":"2008-01-08T16:38:56Z","isPatch":false,"sender":{"key":"devurandom@gmx.net","avatar":null},"body":"Hello!\n\nI am getting \"Odd number of elements in anonymous hash at /usr/bin/git-svn \nline 1760.\" (normal output, no warning/error) during git-svn-clone.\nI am using git version 1.5.4.rc2.\n\nLine 1760 is this (with context, marked with '!!'):\n    # see if we have it in our config, first:\n    eval {\n        my $section = \"svn-remote.$self->{repo_id}\";\n!!        $svnsync = {\n          url => tmp_config('--get', \"$section.svnsync-url\"),\n          uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n        }\n    };\n\nThe commandline was \"git svn \nclone --authors-file=/var/git/org.gna.warzone.git/authors --use-svnsync-props --stdlayout \nfile:///var/svn/warzone2100/ org.gna.warzone.git/\"\n\nI assume this is some kind of bug?\n\n--Dennis\n"},{"id":"64754","messageId":"7vbq7wteq4.fsf@gitster.siamese.dyndns.org","threadId":"11535","inReplyTo":"200801081738.56624.devurandom@gmx.net","subject":"Re: Odd number of elements in anonymous hash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-08T17:21:55Z","receivedAt":"2008-01-08T17:21:55Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dennis Schridde <devurandom@gmx.net> writes:\n\n> Hello!\n>\n> I am getting \"Odd number of elements in anonymous hash at /usr/bin/git-svn \n> line 1760.\" (normal output, no warning/error) during git-svn-clone.\n> I am using git version 1.5.4.rc2.\n>\n> Line 1760 is this (with context, marked with '!!'):\n>     # see if we have it in our config, first:\n>     eval {\n>         my $section = \"svn-remote.$self->{repo_id}\";\n> !!        $svnsync = {\n>           url => tmp_config('--get', \"$section.svnsync-url\"),\n>           uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n>         }\n>     };\n>\n> The commandline was \"git svn \n> clone --authors-file=/var/git/org.gna.warzone.git/authors --use-svnsync-props --stdlayout \n> file:///var/svn/warzone2100/ org.gna.warzone.git/\"\n>\n> I assume this is some kind of bug?\n\nMore than one svn-remote.$your_repo.svnsync-{url,uuid}?\n\n(Eric CC'ed).\n"},{"id":"64756","messageId":"200801081830.25722.devurandom@gmx.net","threadId":"11535","inReplyTo":"7vbq7wteq4.fsf@gitster.siamese.dyndns.org","subject":"Re: Odd number of elements in anonymous hash","fromName":"Dennis Schridde","fromEmail":"devurandom@gmx.net","sentAt":"2008-01-08T17:30:22Z","receivedAt":"2008-01-08T17:30:22Z","isPatch":false,"sender":{"key":"devurandom@gmx.net","avatar":null},"body":"Am Dienstag, 8. Januar 2008 18:21:55 schrieb Junio C Hamano:\n> Dennis Schridde <devurandom@gmx.net> writes:\n> > Hello!\n> >\n> > I am getting \"Odd number of elements in anonymous hash at\n> > /usr/bin/git-svn line 1760.\" (normal output, no warning/error) during\n> > git-svn-clone. I am using git version 1.5.4.rc2.\n> >\n> > Line 1760 is this (with context, marked with '!!'):\n> >     # see if we have it in our config, first:\n> >     eval {\n> >         my $section = \"svn-remote.$self->{repo_id}\";\n> > !!        $svnsync = {\n> >           url => tmp_config('--get', \"$section.svnsync-url\"),\n> >           uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n> >         }\n> >     };\n> >\n> > The commandline was \"git svn\n> > clone --authors-file=/var/git/org.gna.warzone.git/authors\n> > --use-svnsync-props --stdlayout file:///var/svn/warzone2100/\n> > org.gna.warzone.git/\"\n> >\n> > I assume this is some kind of bug?\n>\n> More than one svn-remote.$your_repo.svnsync-{url,uuid}?\nPS: It doesn't happen for every revision and the folders (and thus config) \nwere empty before. The config doesn't list any \"svnsync-*\" during the import \nprocess.\n"},{"id":"64883","messageId":"20080109225824.GA10193@hand.yhbt.net","threadId":"11535","inReplyTo":"7vbq7wteq4.fsf@gitster.siamese.dyndns.org","subject":"Re: Odd number of elements in anonymous hash","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-01-09T22:58:24Z","receivedAt":"2008-01-09T22:58:24Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Dennis Schridde <devurandom@gmx.net> writes:\n> \n> > Hello!\n> >\n> > I am getting \"Odd number of elements in anonymous hash at /usr/bin/git-svn \n> > line 1760.\" (normal output, no warning/error) during git-svn-clone.\n> > I am using git version 1.5.4.rc2.\n> >\n> > Line 1760 is this (with context, marked with '!!'):\n> >     # see if we have it in our config, first:\n> >     eval {\n> >         my $section = \"svn-remote.$self->{repo_id}\";\n> > !!        $svnsync = {\n> >           url => tmp_config('--get', \"$section.svnsync-url\"),\n> >           uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n> >         }\n> >     };\n> >\n> > The commandline was \"git svn \n> > clone --authors-file=/var/git/org.gna.warzone.git/authors --use-svnsync-props --stdlayout \n> > file:///var/svn/warzone2100/ org.gna.warzone.git/\"\n> >\n> > I assume this is some kind of bug?\n> \n> More than one svn-remote.$your_repo.svnsync-{url,uuid}?\n> \n> (Eric CC'ed).\n\nI don't use svnsync myself.  I think Sam does, or would have more\ninsight into this than myself.  I'll hopefully have time to take a\nharder look at it later tonight.\n\n-- \nEric Wong\n"},{"id":"64908","messageId":"20080110083846.GA15047@soma","threadId":"11535","inReplyTo":"200801081830.25722.devurandom@gmx.net","subject":"Re: Odd number of elements in anonymous hash","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-01-10T08:38:46Z","receivedAt":"2008-01-10T08:38:46Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Dennis Schridde <devurandom@gmx.net> wrote:\n> Am Dienstag, 8. Januar 2008 18:21:55 schrieb Junio C Hamano:\n> > Dennis Schridde <devurandom@gmx.net> writes:\n> > > Hello!\n> > >\n> > > I am getting \"Odd number of elements in anonymous hash at\n> > > /usr/bin/git-svn line 1760.\" (normal output, no warning/error) during\n> > > git-svn-clone. I am using git version 1.5.4.rc2.\n> > >\n> > > Line 1760 is this (with context, marked with '!!'):\n> > >     # see if we have it in our config, first:\n> > >     eval {\n> > >         my $section = \"svn-remote.$self->{repo_id}\";\n> > > !!        $svnsync = {\n> > >           url => tmp_config('--get', \"$section.svnsync-url\"),\n> > >           uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n> > >         }\n> > >     };\n> > >\n> > > The commandline was \"git svn\n> > > clone --authors-file=/var/git/org.gna.warzone.git/authors\n> > > --use-svnsync-props --stdlayout file:///var/svn/warzone2100/\n> > > org.gna.warzone.git/\"\n> > >\n> > > I assume this is some kind of bug?\n> >\n> > More than one svn-remote.$your_repo.svnsync-{url,uuid}?\n> PS: It doesn't happen for every revision and the folders (and thus config) \n> were empty before. The config doesn't list any \"svnsync-*\" during the import \n> process.\n\nCan you look in .git/svn/.metadata for the svnsync-* values?  Thanks.\n\nI downloaded your repository and couldn't reproduce it locally.\n\n-- \nEric Wong\n"},{"id":"64916","messageId":"200801101204.58300.devurandom@gmx.net","threadId":"11535","inReplyTo":"20080110083846.GA15047@soma","subject":"Re: Odd number of elements in anonymous hash","fromName":"Dennis Schridde","fromEmail":"devurandom@gmx.net","sentAt":"2008-01-10T11:04:54Z","receivedAt":"2008-01-10T11:04:54Z","isPatch":false,"sender":{"key":"devurandom@gmx.net","avatar":null},"body":"Am Donnerstag, 10. Januar 2008 09:38:46 schrieb Eric Wong:\n> Dennis Schridde <devurandom@gmx.net> wrote:\n> > Am Dienstag, 8. Januar 2008 18:21:55 schrieb Junio C Hamano:\n> > > Dennis Schridde <devurandom@gmx.net> writes:\n> > > > Hello!\n> > > >\n> > > > I am getting \"Odd number of elements in anonymous hash at\n> > > > /usr/bin/git-svn line 1760.\" (normal output, no warning/error) during\n> > > > git-svn-clone. I am using git version 1.5.4.rc2.\n> > > >\n> > > > Line 1760 is this (with context, marked with '!!'):\n> > > >     # see if we have it in our config, first:\n> > > >     eval {\n> > > >         my $section = \"svn-remote.$self->{repo_id}\";\n> > > > !!        $svnsync = {\n> > > >           url => tmp_config('--get', \"$section.svnsync-url\"),\n> > > >           uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n> > > >         }\n> > > >     };\n> > > >\n> > > > The commandline was \"git svn\n> > > > clone --authors-file=/var/git/org.gna.warzone.git/authors\n> > > > --use-svnsync-props --stdlayout file:///var/svn/warzone2100/\n> > > > org.gna.warzone.git/\"\n> > > >\n> > > > I assume this is some kind of bug?\n> > >\n> > > More than one svn-remote.$your_repo.svnsync-{url,uuid}?\n> >\n> > PS: It doesn't happen for every revision and the folders (and thus\n> > config) were empty before. The config doesn't list any \"svnsync-*\" during\n> > the import process.\n>\n> Can you look in .git/svn/.metadata for the svnsync-* values?  Thanks.\n>\n> I downloaded your repository and couldn't reproduce it locally.\nThis is the file left after the segfault from the other mail:\n---\n[svn-remote \"svn\"]\n    reposRoot = file:///var/svn/warzone2100\n    uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n    branches-maxRev = 14\n    tags-maxRev = 14\n    svnsync-uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\\n\n    svnsync-url = http://svn.gna.org/svn/warzone\n[svn-remote \"tags/1.10a.12\"]\n    reposRoot = file:///var/svn/warzone2100\n    uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n---\n\nI will post the whole file asap. (I think recompiling git,svn,perl with \nCFLAGS=-g and not striping the binary magically solves the problem, at least \nit seemed to when I tried to create a backtrace.)\n\n--Dennis\n"},{"id":"64935","messageId":"200801101813.45938.devurandom@gmx.net","threadId":"11535","inReplyTo":"200801101204.58300.devurandom@gmx.net","subject":"Re: Odd number of elements in anonymous hash","fromName":"Dennis Schridde","fromEmail":"devurandom@gmx.net","sentAt":"2008-01-10T17:13:41Z","receivedAt":"2008-01-10T17:13:41Z","isPatch":false,"sender":{"key":"devurandom@gmx.net","avatar":null},"body":"Am Donnerstag, 10. Januar 2008 12:04:54 schrieb Dennis Schridde:\n> Am Donnerstag, 10. Januar 2008 09:38:46 schrieb Eric Wong:\n> > Dennis Schridde <devurandom@gmx.net> wrote:\n> > > Am Dienstag, 8. Januar 2008 18:21:55 schrieb Junio C Hamano:\n> > > > Dennis Schridde <devurandom@gmx.net> writes:\n> > > > > I am getting \"Odd number of elements in anonymous hash at\n> > > > > /usr/bin/git-svn line 1760.\" (normal output, no warning/error)\n> > > > > during git-svn-clone. I am using git version 1.5.4.rc2.\n> >\n> > Can you look in .git/svn/.metadata for the svnsync-* values?  Thanks.\n> >\n> > I downloaded your repository and couldn't reproduce it locally.\n>\n> This is the file left after the segfault from the other mail:\n> ---\n> [svn-remote \"svn\"]\n>     reposRoot = file:///var/svn/warzone2100\n>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n>     branches-maxRev = 14\n>     tags-maxRev = 14\n>     svnsync-uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\\n\n>     svnsync-url = http://svn.gna.org/svn/warzone\n> [svn-remote \"tags/1.10a.12\"]\n>     reposRoot = file:///var/svn/warzone2100\n>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n> ---\nThe rest of the file is rather boring. The \"svn\" remote is not changed \n(besides having higher revisions) and the other remotes look exactly like \nthe \"tags/1.10a.12\" one.\n\nSomehow I think that the \\n at the end of the svnsync-uuid shouldn't be \nthere... It could be that this is the same linebreak which prevents people \nfrom relocating (svn switch --relocate) from svn://svn.gna.org/svn/warzone to \nhttp://svn.gna.org/svn/warzone, so that would be a Gna bug.\nHowever git-svn shouldn't throw any warnings (or even (make perl) crash?) on \nsuch occasions, either...\n\nI now got it to run through without a segfault, by compiling an unstriped perl \nbinary with debug symbols (Gentoo: FEATURES=nostrip CFLAGS=\"... -g\").\nMaybe this is a bug in GCC or something...\n\nThe \"Odd number of elements in anonymous hash\" still stays, though.\n\n--Dennis\n\nsvn, version 1.4.6 (r28521)\ngit version 1.5.4.rc2\nThis is perl, v5.8.8 built for i686-linux\n"},{"id":"64940","messageId":"7v63y178a3.fsf@gitster.siamese.dyndns.org","threadId":"11535","inReplyTo":"200801101813.45938.devurandom@gmx.net","subject":"Re: Odd number of elements in anonymous hash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-10T20:08:52Z","receivedAt":"2008-01-10T20:08:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dennis Schridde <devurandom@gmx.net> writes:\n\n>> [svn-remote \"svn\"]\n>>     reposRoot = file:///var/svn/warzone2100\n>>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n>>     branches-maxRev = 14\n>>     tags-maxRev = 14\n>>     svnsync-uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\\n\n>>     svnsync-url = http://svn.gna.org/svn/warzone\n>> [svn-remote \"tags/1.10a.12\"]\n>>     reposRoot = file:///var/svn/warzone2100\n>>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n>> ---\n> The rest of the file is rather boring. The \"svn\" remote is not changed \n> (besides having higher revisions) and the other remotes look exactly like \n> the \"tags/1.10a.12\" one.\n>\n> Somehow I think that the \\n at the end of the svnsync-uuid shouldn't be \n> there... It could be that this is the same linebreak which prevents people \n> from relocating (svn switch --relocate) from svn://svn.gna.org/svn/warzone to \n> http://svn.gna.org/svn/warzone, so that would be a Gna bug.\n> However git-svn shouldn't throw any warnings (or even (make perl) crash?) on \n> such occasions, either...\n>\n> I now got it to run through without a segfault, by compiling an unstriped perl \n> binary with debug symbols (Gentoo: FEATURES=nostrip CFLAGS=\"... -g\").\n> Maybe this is a bug in GCC or something...\n>\n> The \"Odd number of elements in anonymous hash\" still stays, though.\n\nThe code in question is:\n\n\tmy $svnsync;\n\t# see if we have it in our config, first:\n\teval {\n\t\tmy $section = \"svn-remote.$self->{repo_id}\";\n\t\t$svnsync = {\n\t\t  url => tmp_config('--get', \"$section.svnsync-url\"),\n\t\t  uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n\t\t}\n\t};\n\nI think the \"Odd number\" is an indication that one of the\ntmp_config() calls is returning an even number of elements (so\nthe hash whose ref will be stored in $svnsync ends up having an\nodd number of elements), and that is why I initially asked you\nabout \"more than one\" svnsync-url.  0 is also an even number,\nand it could be that it is not finding any.\n\nHow about doing something ugly like this _just for diagnosis_?\n\n\tmy $svnsync;\n\t# see if we have it in our config, first:\n\teval {\n\t\tmy $section = \"svn-remote.$self->{repo_id}\";\n\t\tmy @u = tmp_config('--get', \"$section.svnsync-url\");\n\t\tmy @v = tmp_config('--get', \"$section.svnsync-uuid\");\n\t\tif (@u != 1 || @v != 1) {\n                \tprint STDERR \"Oops: <$section> $#u <@u> $#v <@v>\\n\";\n\t\t}\n\t\t$svnsync = {\n\t\t  url => @u,\n\t\t  uuid => @v,\n\t\t}\n\t};\n"},{"id":"64951","messageId":"200801102213.04082.devurandom@gmx.net","threadId":"11535","inReplyTo":"7v63y178a3.fsf@gitster.siamese.dyndns.org","subject":"Re: Odd number of elements in anonymous hash","fromName":"Dennis Schridde","fromEmail":"devurandom@gmx.net","sentAt":"2008-01-10T21:13:00Z","receivedAt":"2008-01-10T21:13:00Z","isPatch":false,"sender":{"key":"devurandom@gmx.net","avatar":null},"body":"Am Donnerstag, 10. Januar 2008 21:08:52 schrieb Junio C Hamano:\n> Dennis Schridde <devurandom@gmx.net> writes:\n> >> [svn-remote \"svn\"]\n> >>     reposRoot = file:///var/svn/warzone2100\n> >>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n> >>     branches-maxRev = 14\n> >>     tags-maxRev = 14\n> >>     svnsync-uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\\n\n> >>     svnsync-url = http://svn.gna.org/svn/warzone\n> >> [svn-remote \"tags/1.10a.12\"]\n> >>     reposRoot = file:///var/svn/warzone2100\n> >>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n> >> ---\n> >\n> > The rest of the file is rather boring. The \"svn\" remote is not changed\n> > (besides having higher revisions) and the other remotes look exactly like\n> > the \"tags/1.10a.12\" one.\n> >\n> > Somehow I think that the \\n at the end of the svnsync-uuid shouldn't be\n> > there... It could be that this is the same linebreak which prevents\n> > people from relocating (svn switch --relocate) from\n> > svn://svn.gna.org/svn/warzone to http://svn.gna.org/svn/warzone, so that\n> > would be a Gna bug.\n> > However git-svn shouldn't throw any warnings (or even (make perl) crash?)\n> > on such occasions, either...\n> >\n> > I now got it to run through without a segfault, by compiling an unstriped\n> > perl binary with debug symbols (Gentoo: FEATURES=nostrip CFLAGS=\"...\n> > -g\"). Maybe this is a bug in GCC or something...\n> >\n> > The \"Odd number of elements in anonymous hash\" still stays, though.\n>\n> The code in question is:\n>\n> \tmy $svnsync;\n> \t# see if we have it in our config, first:\n> \teval {\n> \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n> \t\t$svnsync = {\n> \t\t  url => tmp_config('--get', \"$section.svnsync-url\"),\n> \t\t  uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n> \t\t}\n> \t};\n>\n> I think the \"Odd number\" is an indication that one of the\n> tmp_config() calls is returning an even number of elements (so\n> the hash whose ref will be stored in $svnsync ends up having an\n> odd number of elements), and that is why I initially asked you\n> about \"more than one\" svnsync-url.  0 is also an even number,\n> and it could be that it is not finding any.\n>\n> How about doing something ugly like this _just for diagnosis_?\n>\n> \tmy $svnsync;\n> \t# see if we have it in our config, first:\n> \teval {\n> \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n> \t\tmy @u = tmp_config('--get', \"$section.svnsync-url\");\n> \t\tmy @v = tmp_config('--get', \"$section.svnsync-uuid\");\n> \t\tif (@u != 1 || @v != 1) {\n>                 \tprint STDERR \"Oops: <$section> $#u <@u> $#v <@v>\\n\";\n> \t\t}\n> \t\t$svnsync = {\n> \t\t  url => @u,\n> \t\t  uuid => @v,\n> \t\t}\n> \t};\nI've created /usr/bin/git-svndbg and changed that part, like you proposed.\nI now get this output. (As it continues to run, there are probably more \noccassions of the Oops.)\n---\nOops: <svn-remote.svn> 0 <http://svn.gna.org/svn/warzone> 1 \n<4a71c877-e1ca-e34f-864e-861f7616d084 >\nOdd number of elements in anonymous hash at /usr/bin/git-svndbg line 1768.\nr13 = ee6d5a48dd5cf1a96ed5217d638f372d2c173d89 (tags/1.10a)\n---\n\n--Dennis\n"},{"id":"64957","messageId":"7vmyrd5p81.fsf@gitster.siamese.dyndns.org","threadId":"11535","inReplyTo":"200801102213.04082.devurandom@gmx.net","subject":"Re: Odd number of elements in anonymous hash","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-10T21:45:50Z","receivedAt":"2008-01-10T21:45:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Dennis Schridde <devurandom@gmx.net> writes:\n\n> Am Donnerstag, 10. Januar 2008 21:08:52 schrieb Junio C Hamano:\n>> Dennis Schridde <devurandom@gmx.net> writes:\n>> >> [svn-remote \"svn\"]\n>> >>     reposRoot = file:///var/svn/warzone2100\n>> >>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n>> >>     branches-maxRev = 14\n>> >>     tags-maxRev = 14\n>> >>     svnsync-uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\\n\n>> >>     svnsync-url = http://svn.gna.org/svn/warzone\n>> >> [svn-remote \"tags/1.10a.12\"]\n>> >>     reposRoot = file:///var/svn/warzone2100\n>> >>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n>> >> ---\n>> >\n>> > The rest of the file is rather boring. The \"svn\" remote is not changed\n>> > (besides having higher revisions) and the other remotes look exactly like\n>> > the \"tags/1.10a.12\" one.\n>> >\n>> > Somehow I think that the \\n at the end of the svnsync-uuid shouldn't be\n>> > there... It could be that this is the same linebreak which prevents\n>> > people from relocating (svn switch --relocate) from\n>> > svn://svn.gna.org/svn/warzone to http://svn.gna.org/svn/warzone, so that\n>> > would be a Gna bug.\n>> > However git-svn shouldn't throw any warnings (or even (make perl) crash?)\n>> > on such occasions, either...\n>> >\n>> > I now got it to run through without a segfault, by compiling an unstriped\n>> > perl binary with debug symbols (Gentoo: FEATURES=nostrip CFLAGS=\"...\n>> > -g\"). Maybe this is a bug in GCC or something...\n>> >\n>> > The \"Odd number of elements in anonymous hash\" still stays, though.\n>>\n>> The code in question is:\n>>\n>> \tmy $svnsync;\n>> \t# see if we have it in our config, first:\n>> \teval {\n>> \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n>> \t\t$svnsync = {\n>> \t\t  url => tmp_config('--get', \"$section.svnsync-url\"),\n>> \t\t  uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n>> \t\t}\n>> \t};\n>>\n>> I think the \"Odd number\" is an indication that one of the\n>> tmp_config() calls is returning an even number of elements (so\n>> the hash whose ref will be stored in $svnsync ends up having an\n>> odd number of elements), and that is why I initially asked you\n>> about \"more than one\" svnsync-url.  0 is also an even number,\n>> and it could be that it is not finding any.\n>>\n>> How about doing something ugly like this _just for diagnosis_?\n>>\n>> \tmy $svnsync;\n>> \t# see if we have it in our config, first:\n>> \teval {\n>> \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n>> \t\tmy @u = tmp_config('--get', \"$section.svnsync-url\");\n>> \t\tmy @v = tmp_config('--get', \"$section.svnsync-uuid\");\n>> \t\tif (@u != 1 || @v != 1) {\n>>                 \tprint STDERR \"Oops: <$section> $#u <@u> $#v <@v>\\n\";\n>> \t\t}\n>> \t\t$svnsync = {\n>> \t\t  url => @u,\n>> \t\t  uuid => @v,\n>> \t\t}\n>> \t};\n> I've created /usr/bin/git-svndbg and changed that part, like you proposed.\n> I now get this output. (As it continues to run, there are probably more \n> occassions of the Oops.)\n> ---\n> Oops: <svn-remote.svn> 0 <http://svn.gna.org/svn/warzone> 1 \n> <4a71c877-e1ca-e34f-864e-861f7616d084 >\n> Odd number of elements in anonymous hash at /usr/bin/git-svndbg line 1768.\n> r13 = ee6d5a48dd5cf1a96ed5217d638f372d2c173d89 (tags/1.10a)\n> ---\n\nExactly.  The trailing newline is taken as a record separator by\ntmp_config subroutine.\n"},{"id":"65139","messageId":"20080112071355.GA17021@soma","threadId":"11535","inReplyTo":"7vmyrd5p81.fsf@gitster.siamese.dyndns.org","subject":"[PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-01-12T07:13:55Z","receivedAt":"2008-01-12T07:13:55Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Repositories generated by svnsync cannot be relied on to have\nproperly set revprops without newlines in UUIDs and URLs.  There\nmay be broken versions of svnsync out there that append extra\nnewlines to UUIDs, or the revprops could've been changed by\nrepository administrators at any time, too.\n\nAt least one repository we've come across has an embedded\nnewline erroneously set in the svnsync-uuid prop.  This is bad\nbecause the trailing newline is taken as another record by the\nGit.pm library, and the wantarray detection causes tmp_config()\nto return an array with an empty-but-existing second element.\n\nWe will now strip leading and trailing whitespace both before\nsetting and after reading the uuid and url for svnsync values.\nWe will also force tmp_config to return a single scalar when\nreading existing values.\n\nSVN UUIDs should never have whitespace in them, and SVN\nrepository URLs should be URI-escaped, so neither of those\nvalues we ever see in git-svn should actually have whitespace\nin them.\n\nThanks to Dennis Schridde for the bug report and Junio for\nhelping diagnose this.\n\nSigned-off-by: Eric Wong <normalperson@yhbt.net>\n---\n git-svn.perl |   18 ++++++++++++------\n 1 files changed, 12 insertions(+), 6 deletions(-)\n\ndiff --git a/git-svn.perl b/git-svn.perl\nindex 3308fe1..f40ad2c 100755\n--- a/git-svn.perl\n+++ b/git-svn.perl\n@@ -1758,10 +1758,16 @@ sub svnsync {\n \t# see if we have it in our config, first:\n \teval {\n \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n-\t\t$svnsync = {\n-\t\t  url => tmp_config('--get', \"$section.svnsync-url\"),\n-\t\t  uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n-\t\t}\n+\n+\t        my $url = tmp_config('--get', \"$section.svnsync-url\");\n+\t\t($url) = ($url =~ m{^([a-z\\+]+://\\S+)$}) or\n+\t           die \"doesn't look right - svn:sync-from-url is '$url'\\n\";\n+\n+\t        my $uuid = tmp_config('--get', \"$section.svnsync-uuid\");\n+\t\t($uuid) = ($uuid =~ m{^([0-9a-f\\-]{30,})$}) or\n+\t           die \"doesn't look right - svn:sync-from-uuid is '$uuid'\\n\";\n+\n+\t\t$svnsync = { url => $url, uuid => $uuid }\n \t};\n \tif ($svnsync && $svnsync->{url} && $svnsync->{uuid}) {\n \t\treturn $self->{svnsync} = $svnsync;\n@@ -1772,11 +1778,11 @@ sub svnsync {\n \tmy $rp = $self->ra->rev_proplist(0);\n \n \tmy $url = $rp->{'svn:sync-from-url'} or die $err . \"url\\n\";\n-\t$url =~ m{^[a-z\\+]+://} or\n+\t($url) = ($url =~ m{^([a-z\\+]+://\\S+)$}) or\n \t           die \"doesn't look right - svn:sync-from-url is '$url'\\n\";\n \n \tmy $uuid = $rp->{'svn:sync-from-uuid'} or die $err . \"uuid\\n\";\n-\t$uuid =~ m{^[0-9a-f\\-]{30,}$} or\n+\t($uuid) = ($uuid =~ m{^([0-9a-f\\-]{30,})$}) or\n \t           die \"doesn't look right - svn:sync-from-uuid is '$uuid'\\n\";\n \n \tmy $section = \"svn-remote.$self->{repo_id}\";\n-- \nEric Wong\n"},{"id":"65152","messageId":"7vzlvbv5m9.fsf@gitster.siamese.dyndns.org","threadId":"11535","inReplyTo":"20080112071355.GA17021@soma","subject":"Re: [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-12T07:57:02Z","receivedAt":"2008-01-12T07:57:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n> diff --git a/git-svn.perl b/git-svn.perl\n> index 3308fe1..f40ad2c 100755\n> --- a/git-svn.perl\n> +++ b/git-svn.perl\n> @@ -1758,10 +1758,16 @@ sub svnsync {\n>  \t# see if we have it in our config, first:\n>  \teval {\n>  \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n> -\t\t$svnsync = {\n> -\t\t  url => tmp_config('--get', \"$section.svnsync-url\"),\n> -\t\t  uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n> -\t\t}\n> +\n> +\t        my $url = tmp_config('--get', \"$section.svnsync-url\");\n> +\t\t($url) = ($url =~ m{^([a-z\\+]+://\\S+)$}) or\n> +\t           die \"doesn't look right - svn:sync-from-url is '$url'\\n\";\n\nWhen I checked tmp_config(), I thought that it was returning the\nfirst element (taking the output of \"config --get\" as a\nLF-terminated list) when called in list context, so this would\ngive the correct sync-url after stripping the trailing LF for\nDennis's case.  The first assignment looks fine, but the second\none looks very funny.\n\nIs it only me who finds that\n\n\t($var) = ($var =~ m{^(any regexp)$}) or die \"message\"\n\nis extremely a roundabout and hard-to-read way to say:\n\n\tif ($var !~ m{^(the same regexp)$} {\n        \tdie \"message\";\n\t}\n\nwhich is much easier to read?\n\nI said the first one looks fine, but actually I really _hate_\nPerl subs that use wantarray and return one element in scalar\ncontext, and return a list in list context.\n\nThis forces the programmer who calls the sub to read the code of\nthe sub and know that it uses this unusual calling convention.\nIt forbids them to rely on their common-sense acquired from\nexperience while coding in Perl, that most functions do not do\nthat, and a usual sub that is capable of returning a list in a\nlist context you can find out the number of elemenets, the first\nelement, and the first few elements by using:\n\n\tsub returns_list {\n        \tmy @a = qw(a b c);\n                return @a;\n\t}\n\n\tmy $number_of_elems = returns_list();\n\tmy ($first_element) = returns_list();\n\tmy ($first, $second) = returns_list();\n\nIOW, writing\n\n\tsub returns_funny {\n        \tmy @a = qw(a b c);\n                return wantarray ? @a : $a[0];\n\t}\n\nmay make you feel as if you have become a power-coder, and might\neven give you a false sense that some parts of your code can\nbecome simpler thanks to that, because you can now write:\n\n\tmy $first_element = returns_list();\n\ni.e. you did not have to type WHOLE TWO LETTERS ( and )!\n\nBut in the longer run, when you want/need other people to help\nmaintaining such a code, you create unnecessary burden on them.\n"},{"id":"65161","messageId":"20080112091242.GA27109@soma","threadId":"11535","inReplyTo":"7vzlvbv5m9.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2008-01-12T09:12:42Z","receivedAt":"2008-01-12T09:12:42Z","isPatch":true,"sender":{"key":"e@80x24.org","avatar":null},"body":"Junio C Hamano <gitster@pobox.com> wrote:\n> Eric Wong <normalperson@yhbt.net> writes:\n> > diff --git a/git-svn.perl b/git-svn.perl\n> > index 3308fe1..f40ad2c 100755\n> > --- a/git-svn.perl\n> > +++ b/git-svn.perl\n> > @@ -1758,10 +1758,16 @@ sub svnsync {\n> >  \t# see if we have it in our config, first:\n> >  \teval {\n> >  \t\tmy $section = \"svn-remote.$self->{repo_id}\";\n> > -\t\t$svnsync = {\n> > -\t\t  url => tmp_config('--get', \"$section.svnsync-url\"),\n> > -\t\t  uuid => tmp_config('--get', \"$section.svnsync-uuid\"),\n> > -\t\t}\n> > +\n> > +\t        my $url = tmp_config('--get', \"$section.svnsync-url\");\n> > +\t\t($url) = ($url =~ m{^([a-z\\+]+://\\S+)$}) or\n> > +\t           die \"doesn't look right - svn:sync-from-url is '$url'\\n\";\n> \n> When I checked tmp_config(), I thought that it was returning the\n> first element (taking the output of \"config --get\" as a\n> LF-terminated list) when called in list context, so this would\n> give the correct sync-url after stripping the trailing LF for\n> Dennis's case.  The first assignment looks fine, but the second\n> one looks very funny.\n> \n> Is it only me who finds that\n> \n> \t($var) = ($var =~ m{^(any regexp)$}) or die \"message\"\n> \n> is extremely a roundabout and hard-to-read way to say:\n> \n> \tif ($var !~ m{^(the same regexp)$} {\n>         \tdie \"message\";\n> \t}\n> \n> which is much easier to read?\n\nThe statements are not equivalent, however.  I'd have to add\n\n\t$var = $1;\n\ntoo, because I needed to extract what was inside the ( ) since the '$'\ndoesn't catch the trailing newline, either.  I also couldn't find any of\nthe /sm, /m, /s switches useful for making '$' not accept the trailing\nnewline, either.\n\nI also consider the \"or die \" part of the line to be uninteresting,\nand would rather not waste extra space on it.\n\n> I said the first one looks fine, but actually I really _hate_\n> Perl subs that use wantarray and return one element in scalar\n> context, and return a list in list context.\n> \n> This forces the programmer who calls the sub to read the code of\n> the sub and know that it uses this unusual calling convention.\n> It forbids them to rely on their common-sense acquired from\n> experience while coding in Perl, that most functions do not do\n> that, and a usual sub that is capable of returning a list in a\n> list context you can find out the number of elemenets, the first\n> element, and the first few elements by using:\n> \n> \tsub returns_list {\n>         \tmy @a = qw(a b c);\n>                 return @a;\n> \t}\n> \n> \tmy $number_of_elems = returns_list();\n> \tmy ($first_element) = returns_list();\n> \tmy ($first, $second) = returns_list();\n> \n> IOW, writing\n> \n> \tsub returns_funny {\n>         \tmy @a = qw(a b c);\n>                 return wantarray ? @a : $a[0];\n> \t}\n> \n> may make you feel as if you have become a power-coder, and might\n> even give you a false sense that some parts of your code can\n> become simpler thanks to that, because you can now write:\n> \n> \tmy $first_element = returns_list();\n> \n> i.e. you did not have to type WHOLE TWO LETTERS ( and )!\n> \n> But in the longer run, when you want/need other people to help\n> maintaining such a code, you create unnecessary burden on them.\n\nGood points, I've been mindlessly taking \"interesting\" things from other\nPerl code I've seen over the years and using it in my own without\nthinking about it too hard :x\n\nI'll avoid them in the future.  Unfortunately, Git.pm also suffers from\nthis as well.\n\n-- \nEric Wong\n"},{"id":"65164","messageId":"20080112095505.GA5681@atjola.homenet","threadId":"11535","inReplyTo":"20080112091242.GA27109@soma","subject":"Re: [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-01-12T09:55:05Z","receivedAt":"2008-01-12T09:55:05Z","isPatch":true,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"On 2008.01.12 01:12:42 -0800, Eric Wong wrote:\n> Junio C Hamano <gitster@pobox.com> wrote:\n> > Is it only me who finds that\n> > \n> > \t($var) = ($var =~ m{^(any regexp)$}) or die \"message\"\n> > \n> > is extremely a roundabout and hard-to-read way to say:\n> > \n> > \tif ($var !~ m{^(the same regexp)$} {\n> >         \tdie \"message\";\n> > \t}\n> > \n> > which is much easier to read?\n> \n> The statements are not equivalent, however.  I'd have to add\n> \n> \t$var = $1;\n> \n> too, because I needed to extract what was inside the ( ) since the '$'\n> doesn't catch the trailing newline, either.  I also couldn't find any of\n> the /sm, /m, /s switches useful for making '$' not accept the trailing\n> newline, either.\n\nThe \\z assertion will do, eg m/^foo\\z/ will only match exactly \"foo\",\nnot \"foo\\n\". As it is a zero-width assertion, you can also write\nm/^foo\\z$/ if you prefer that.\n\nBjörn\n"},{"id":"65171","messageId":"200801121334.18632.devurandom@gmx.net","threadId":"11535","inReplyTo":"20080112071355.GA17021@soma","subject":"Re: [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops","fromName":"Dennis Schridde","fromEmail":"devurandom@gmx.net","sentAt":"2008-01-12T12:34:18Z","receivedAt":"2008-01-12T12:34:18Z","isPatch":true,"sender":{"key":"devurandom@gmx.net","avatar":null},"body":"Am Samstag, 12. Januar 2008 08:13:55 schrieben Sie:\n> Repositories generated by svnsync cannot be relied on to have\n> properly set revprops without newlines in UUIDs and URLs.  There\n> may be broken versions of svnsync out there that append extra\n> newlines to UUIDs, or the revprops could've been changed by\n> repository administrators at any time, too.\n>\n> At least one repository we've come across has an embedded\n> newline erroneously set in the svnsync-uuid prop.  This is bad\n> because the trailing newline is taken as another record by the\n> Git.pm library, and the wantarray detection causes tmp_config()\n> to return an array with an empty-but-existing second element.\n>\n> We will now strip leading and trailing whitespace both before\n> setting and after reading the uuid and url for svnsync values.\n> We will also force tmp_config to return a single scalar when\n> reading existing values.\n>\n> SVN UUIDs should never have whitespace in them, and SVN\n> repository URLs should be URI-escaped, so neither of those\n> values we ever see in git-svn should actually have whitespace\n> in them.\n>\n> Thanks to Dennis Schridde for the bug report and Junio for\n> helping diagnose this.\nThanks! This patch seems to work, at least the \"Odd number...\" message is \ngone. The segfault with a non-debug perl stays, though. But I guess that is a \ndifferent problem.\n\n--Dennis\n"},{"id":"65205","messageId":"7vprw6ub1f.fsf@gitster.siamese.dyndns.org","threadId":"11535","inReplyTo":"20080112091242.GA27109@soma","subject":"Re: [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-12T18:57:32Z","receivedAt":"2008-01-12T18:57:32Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Eric Wong <normalperson@yhbt.net> writes:\n\n> The statements are not equivalent, however.  I'd have to add\n>\n> \t$var = $1;\n>\n> too, because I needed to extract what was inside the ( ) since the '$'\n> doesn't catch the trailing newline, either.\n\nAhh, _stupid me_.\n\nYes, you said '$', not '\\Z', but somehow I mistook m|^(.*)$| as\na no-op \"whole thing\".  Sorry.\n\n> Good points, I've been mindlessly taking \"interesting\" things from other\n> Perl code I've seen over the years and using it in my own without\n> thinking about it too hard :x\n>\n> I'll avoid them in the future.  Unfortunately, Git.pm also suffers from\n> this as well.\n\nGit.pm is even worse.  It uses the line-noise prototype which is\na very good and cute hack to allow people to (1) emulate Perl's\nbuilt-in and (2) come up with syntax sugars, but has a similar\nissue that defeats old-school intuition as wantarray-return\nsubroutines does.\n\nThe caller needs to be careful about receiving return values\nwith wantarray-return subroutines.  The caller needs to be\ncareful about how to send in the parameters with line-noise\nprototyped subs.\n\nIn any case, this kind of clean-up is not within the scope of\nchanges during rc cycle.  I'll take your bugfix as is.\n\nThanks.\n"},{"id":"65213","messageId":"7vr6gmsuvv.fsf@gitster.siamese.dyndns.org","threadId":"11535","inReplyTo":"7vprw6ub1f.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] git-svn: handle leading/trailing whitespace from svnsync revprops","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-01-12T19:31:48Z","receivedAt":"2008-01-12T19:31:48Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Git.pm is even worse.  It uses the line-noise prototype...\n\nSorry, I misremembered.  Git.pm is not a prototype offender.\n"},{"id":"66526","messageId":"47991ACA.7010507@vilain.net","threadId":"11535","inReplyTo":"200801241513.45088.devurandom@gmx.net","subject":"Re: Odd number of elements in anonymous hash","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2008-01-24T23:10:02Z","receivedAt":"2008-01-24T23:10:02Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Dennis Schridde wrote:\n>>> Server: git config:\n>>> ------\n [...]\n>>> [svn-remote \"svn\"]\n>>>         useSvnsyncProps = 1\n>>>         url = file:///var/svn/warzone2100\n>>>         fetch = trunk:refs/remotes/trunk\n>>>         branches = branches/*:refs/remotes/*\n>>>         tags = tags/*:refs/remotes/tags/*\n>>> ------\n [...]\n>>> Local config:\n>>> ------\n [...]\n>>> [remote \"origin\"]\n>>>         url = git://git.kynes.de/org.gna.warzone2100.git\n>>>         fetch = +refs/heads/*:refs/remotes/origin/*\n>> You need to make that:\n>>\n>>   fetch = refs/remotes/*:refs/remotes/*\n>>\n>> And re-run 'git fetch' to use git-svn fetch on the cloned repository.\n>> git-svn is expecting the refs/ space to be populated in the same way\n>> that it is on the repository doing the initial fetch.\n> Thanks a lot!\n> That worked!\n> \n> Possibly you should update the manpage, so no others run into this.\n> It currently just says:\n>        # Tell git-svn which branch contains the Subversion commits\n>                git update-ref refs/remotes/git-svn origin/master\n> Which is apparently not sufficient (or outdated?).\n\nIndeed, that would be helpful.\n\nSubject: [PATCH] git-svn(1): update instructions for resuming a git-svn clone\n\ngit-svn expects its references under refs/remotes/*; but these will\nnot be copied or set by \"git clone\"; put in this man page the manual\nfiddling that is required with current git-svn to get this to work.\n\nSigned-off-by: Sam Vilain <sam.vilain@catalyst.net.nz>\n---\n Documentation/git-svn.txt |   11 +++++++----\n 1 files changed, 7 insertions(+), 4 deletions(-)\n\ndiff --git a/Documentation/git-svn.txt b/Documentation/git-svn.txt\nindex e1a1d46..b1d527f 100644\n--- a/Documentation/git-svn.txt\n+++ b/Documentation/git-svn.txt\n@@ -456,10 +456,13 @@ have each person clone that repository with 'git clone':\n ------------------------------------------------------------------------\n # Do the initial import on a server\n \tssh server \"cd /pub && git-svn clone http://svn.foo.org/project\n-# Clone locally\n-\tgit clone server:/pub/project\n-# Tell git-svn which branch contains the Subversion commits\n-\tgit update-ref refs/remotes/git-svn origin/master\n+# Clone locally - make sure the refs/remotes/ space matches the server\n+\tmkdir project\n+\tcd project\n+\tgit-init\n+\tgit remote add origin server:/pub/project\n+\tgit config --add remote.origin.fetch=+refs/remotes/*:refs/remotes/*\n+\tgit fetch\n # Initialize git-svn locally (be sure to use the same URL and -T/-b/-t options as were used on server)\n \tgit-svn init http://svn.foo.org/project\n # Pull the latest changes from Subversion\n-- \n1.5.3.5\n"}]}