summaryrefslogtreecommitdiff
path: root/git-cvsserver.perl
diff options
context:
space:
mode:
authorAnders Kaseorg <andersk@MIT.EDU>2013-10-30 04:44:43 -0400
committerJunio C Hamano <gitster@pobox.com>2013-10-30 10:30:30 -0700
commit9462953ad25f9ad6ef933908c317dcbbfd4397ed (patch)
tree21363de163737dbac7321bee4c09be7b00ee67b6 /git-cvsserver.perl
parent1b48d56cfb006baf12d34b5e3150ba2ec1900e08 (diff)
downloadgit-9462953ad25f9ad6ef933908c317dcbbfd4397ed.tar.gz
cvsserver: Determinize output to combat Perl 5.18 hash randomizationak/cvsserver-stabilize-use-of-hash-keys
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>
Diffstat (limited to 'git-cvsserver.perl')
-rwxr-xr-xgit-cvsserver.perl10
1 files changed, 5 insertions, 5 deletions
diff --git a/git-cvsserver.perl b/git-cvsserver.perl
index dfda2b7fbd..349338d966 100755
--- a/git-cvsserver.perl
+++ b/git-cvsserver.perl
@@ -430,10 +430,10 @@ sub req_validrequests
$log->debug("req_validrequests");
- $log->debug("SEND : Valid-requests " . join(" ",keys %$methods));
+ $log->debug("SEND : Valid-requests " . join(" ",sort keys %$methods));
$log->debug("SEND : ok");
- print "Valid-requests " . join(" ",keys %$methods) . "\n";
+ print "Valid-requests " . join(" ",sort keys %$methods) . "\n";
print "ok\n";
}
@@ -2124,7 +2124,7 @@ sub req_diff
print "M retrieving revision $meta2->{revision}\n"
}
print "M diff ";
- foreach my $opt ( keys %{$state->{opt}} )
+ foreach my $opt ( sort keys %{$state->{opt}} )
{
if ( ref $state->{opt}{$opt} eq "ARRAY" )
{
@@ -4050,7 +4050,7 @@ sub update
close FILELIST;
# Detect deleted files
- foreach my $file ( keys %$head )
+ foreach my $file ( sort keys %$head )
{
unless ( exists $seen_files->{$file} or $head->{$file}{filehash} eq "deleted" )
{
@@ -4078,7 +4078,7 @@ sub update
}
$self->delete_head();
- foreach my $file ( keys %$head )
+ foreach my $file ( sort keys %$head )
{
$self->insert_head(
$file,