git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Odd number of elements in anonymous hash

From
Junio C Hamano <gitster@pobox.com>
Date
Jan 10, 2008, 20:08 UTC
Message-ID
<7v63y178a3.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<200801101813.45938.devurandom@gmx.net>
Dennis Schridde <devurandom@gmx.net> writes:
Show 27 quoted lines
>> [svn-remote "svn"]
>>     reposRoot = file:///var/svn/warzone2100
>>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084
>>     branches-maxRev = 14
>>     tags-maxRev = 14
>>     svnsync-uuid = 4a71c877-e1ca-e34f-864e-861f7616d084\n
>>     svnsync-url = http://svn.gna.org/svn/warzone
>> [svn-remote "tags/1.10a.12"]
>>     reposRoot = file:///var/svn/warzone2100
>>     uuid = 4a71c877-e1ca-e34f-864e-861f7616d084
>> ---
> The rest of the file is rather boring. The "svn" remote is not changed 
> (besides having higher revisions) and the other remotes look exactly like 
> the "tags/1.10a.12" one.
>
> Somehow I think that the \n at the end of the svnsync-uuid shouldn't be 
> there... It could be that this is the same linebreak which prevents people 
> from relocating (svn switch --relocate) from svn://svn.gna.org/svn/warzone to 
> http://svn.gna.org/svn/warzone, so that would be a Gna bug.
> However git-svn shouldn't throw any warnings (or even (make perl) crash?) on 
> such occasions, either...
>
> I now got it to run through without a segfault, by compiling an unstriped perl 
> binary with debug symbols (Gentoo: FEATURES=nostrip CFLAGS="... -g").
> Maybe this is a bug in GCC or something...
>
> The "Odd number of elements in anonymous hash" still stays, though.
The code in question is:
	my $svnsync;
	# see if we have it in our config, first:
	eval {
		my $section = "svn-remote.$self->{repo_id}";
		$svnsync = {
		  url => tmp_config('--get', "$section.svnsync-url"),
		  uuid => tmp_config('--get', "$section.svnsync-uuid"),
		}
	};

I think the "Odd number" is an indication that one of the tmp_config() calls is returning an even number of elements (so the hash whose ref will be stored in $svnsync ends up having an odd number of elements), and that is why I initially asked you about "more than one" svnsync-url. 0 is also an even number, and it could be that it is not finding any.

How about doing something ugly like this _just for diagnosis_?
	my $svnsync;
	# see if we have it in our config, first:
	eval {
		my $section = "svn-remote.$self->{repo_id}";
		my @u = tmp_config('--get', "$section.svnsync-url");
		my @v = tmp_config('--get', "$section.svnsync-uuid");
		if (@u != 1 || @v != 1) {
                	print STDERR "Oops: <$section> $#u <@u> $#v <@v>\n";
		}
		$svnsync = {
		  url => @u,
		  uuid => @v,
		}
	};
Previous: Dennis SchriddeNext: Dennis Schridde
Message 7 of 18 in “Odd number of elements in anonymous hash”
  1. Dennis SchriddeJan 8, 2008
  2. Junio C HamanoJan 8, 2008
  3. Dennis SchriddeJan 8, 2008
  4. Eric WongJan 10, 2008
  5. Dennis SchriddeJan 10, 2008
  6. Dennis SchriddeJan 10, 2008
  7. Junio C HamanoJan 10, 2008
  8. Dennis SchriddeJan 10, 2008
  9. Junio C HamanoJan 10, 2008
  10. git-svn: handle leading/trailing whitespace from svnsync revpropsEric Wong, Jan 12, 2008
  11. Junio C HamanoJan 12, 2008
  12. Eric WongJan 12, 2008
  13. Björn SteinbrinkJan 12, 2008
  14. Junio C HamanoJan 12, 2008
  15. Junio C HamanoJan 12, 2008
  16. Dennis SchriddeJan 12, 2008
  17. Eric WongJan 9, 2008
  18. Sam VilainJan 24, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.