cvsserver: Determinize output to combat Perl 5.18 hash randomization
Perl 5.18 randomizes the seed used by its hash function, so iterating through hashes results in different orders from run to run: http://perldoc.perl.org/perl5180delta.html#Hash-overhaul This usually broke t9400 (gitcvs.dbname, gitcvs.ext.dbname, when running cmp on two .sqlite files) and t9402 (check [cvswork3] diff, when running test_cmp on two diffs). To fix this, hide the internal order of hashes with sort when sending output or running database queries. (An alternative workaround is PERL_HASH_SEED=0, but this seems nicer.) Signed-off-by: Anders Kaseorg <andersk@mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Anders Kaseorg committed
Oct 30, 2013 at 04:44 UTC
9462953ad25f9ad6ef933908c317dcbbfd4397ed
1 file changed
+5
-5
git-cvsserver.perl
+5
-5
@@ -430,10 +430,10 @@ sub req_validrequests
430
431
$log->debug("req_validrequests");
432
433
- $log->debug("SEND : Valid-requests " . join(" ",keys %$methods));
433
+ $log->debug("SEND : Valid-requests " . join(" ",sort keys %$methods));
434
$log->debug("SEND : ok");
435
436
- print "Valid-requests " . join(" ",keys %$methods) . "\n";
436
+ print "Valid-requests " . join(" ",sort keys %$methods) . "\n";
437
print "ok\n";
438
}
439
@@ -2124,7 +2124,7 @@ sub req_diff
2124
print "M retrieving revision $meta2->{revision}\n"
2125
}
2126
print "M diff ";
2127
- foreach my $opt ( keys %{$state->{opt}} )
2127
+ foreach my $opt ( sort keys %{$state->{opt}} )
2128
{
2129
if ( ref $state->{opt}{$opt} eq "ARRAY" )
2130
{
@@ -4050,7 +4050,7 @@ sub update
4050
close FILELIST;
4051
4052
# Detect deleted files
4053
- foreach my $file ( keys %$head )
4053
+ foreach my $file ( sort keys %$head )
4054
{
4055
unless ( exists $seen_files->{$file} or $head->{$file}{filehash} eq "deleted" )
4056
{
@@ -4078,7 +4078,7 @@ sub update
4078
}
4079
4080
$self->delete_head();
4081
- foreach my $file ( keys %$head )
4081
+ foreach my $file ( sort keys %$head )
4082
{
4083
$self->insert_head(
4084
$file,