1#!perl -X 2# 3# Regression test for [perl #74170] (missing SPAGAIN after DD_Dump(...)): 4# Since it’s so large, it gets its own file. 5 6BEGIN { 7 if ($ENV{PERL_CORE}){ 8 require Config; import Config; 9 no warnings 'once'; 10 if ($Config{'extensions'} !~ /\bData\/Dumper\b/) { 11 print "1..0 # Skip: Data::Dumper was not built\n"; 12 exit 0; 13 } 14 } 15} 16use strict; 17use Test::More tests => 1; 18use Data::Dumper; 19 20our %repos = real_life_setup(); 21 22$Data::Dumper::Indent = 1; 23# A custom sort sub is necessary for reproducing the bug, as this is where 24# the stack gets reallocated. 25$Data::Dumper::Sortkeys = sub { return [ reverse sort keys %{$_[0]} ]; } 26 unless exists $ENV{NO_SORT_SUB}; 27 28ok(Data::Dumper->Dump([\%repos], [qw(*repos)]), "RT 74170 test"); 29 30sub real_life_setup { 31 # set up the %repos hash in a manner that reflects a real run of 32 # the gitolite "compiler" script: 33 # Yes, all this is necessary to get the stack in such a state that the 34 # custom sort sub will trigger a reallocation. 35 my %repos; 36 push @{ $repos{''}{'@all'} }, (); 37 push @{ $repos{''}{'guser86'} }, (); 38 push @{ $repos{''}{'guser87'} }, (); 39 push @{ $repos{''}{'user88'} }, (); 40 push @{ $repos{''}{'grussell'} }, (); 41 push @{ $repos{''}{'guser0'} }, (); 42 push @{ $repos{''}{'guser1'} }, (); 43 push @{ $repos{''}{'guser10'} }, (); 44 push @{ $repos{''}{'guser11'} }, (); 45 push @{ $repos{''}{'guser12'} }, (); 46 push @{ $repos{''}{'guser13'} }, (); 47 push @{ $repos{''}{'guser14'} }, (); 48 push @{ $repos{''}{'guser15'} }, (); 49 push @{ $repos{''}{'guser16'} }, (); 50 push @{ $repos{''}{'guser17'} }, (); 51 push @{ $repos{''}{'guser18'} }, (); 52 push @{ $repos{''}{'guser19'} }, (); 53 push @{ $repos{''}{'guser2'} }, (); 54 push @{ $repos{''}{'guser20'} }, (); 55 push @{ $repos{''}{'guser21'} }, (); 56 push @{ $repos{''}{'guser22'} }, (); 57 push @{ $repos{''}{'guser23'} }, (); 58 push @{ $repos{''}{'guser24'} }, (); 59 push @{ $repos{''}{'guser25'} }, (); 60 push @{ $repos{''}{'guser26'} }, (); 61 push @{ $repos{''}{'guser27'} }, (); 62 push @{ $repos{''}{'guser28'} }, (); 63 push @{ $repos{''}{'guser29'} }, (); 64 push @{ $repos{''}{'guser3'} }, (); 65 push @{ $repos{''}{'guser30'} }, (); 66 push @{ $repos{''}{'guser31'} }, (); 67 push @{ $repos{''}{'guser32'} }, (); 68 push @{ $repos{''}{'guser33'} }, (); 69 push @{ $repos{''}{'guser34'} }, (); 70 push @{ $repos{''}{'guser35'} }, (); 71 push @{ $repos{''}{'guser36'} }, (); 72 push @{ $repos{''}{'guser37'} }, (); 73 push @{ $repos{''}{'guser38'} }, (); 74 push @{ $repos{''}{'guser39'} }, (); 75 push @{ $repos{''}{'guser4'} }, (); 76 push @{ $repos{''}{'guser40'} }, (); 77 push @{ $repos{''}{'guser41'} }, (); 78 push @{ $repos{''}{'guser42'} }, (); 79 push @{ $repos{''}{'guser43'} }, (); 80 push @{ $repos{''}{'guser44'} }, (); 81 push @{ $repos{''}{'guser45'} }, (); 82 push @{ $repos{''}{'guser46'} }, (); 83 push @{ $repos{''}{'guser47'} }, (); 84 push @{ $repos{''}{'guser48'} }, (); 85 push @{ $repos{''}{'guser49'} }, (); 86 push @{ $repos{''}{'guser5'} }, (); 87 push @{ $repos{''}{'guser50'} }, (); 88 push @{ $repos{''}{'guser51'} }, (); 89 push @{ $repos{''}{'guser52'} }, (); 90 push @{ $repos{''}{'guser53'} }, (); 91 push @{ $repos{''}{'guser54'} }, (); 92 push @{ $repos{''}{'guser55'} }, (); 93 push @{ $repos{''}{'guser56'} }, (); 94 push @{ $repos{''}{'guser57'} }, (); 95 push @{ $repos{''}{'guser58'} }, (); 96 push @{ $repos{''}{'guser59'} }, (); 97 push @{ $repos{''}{'guser6'} }, (); 98 push @{ $repos{''}{'guser60'} }, (); 99 push @{ $repos{''}{'guser61'} }, (); 100 push @{ $repos{''}{'guser62'} }, (); 101 push @{ $repos{''}{'guser63'} }, (); 102 push @{ $repos{''}{'guser64'} }, (); 103 push @{ $repos{''}{'guser65'} }, (); 104 push @{ $repos{''}{'guser66'} }, (); 105 push @{ $repos{''}{'guser67'} }, (); 106 push @{ $repos{''}{'guser68'} }, (); 107 push @{ $repos{''}{'guser69'} }, (); 108 push @{ $repos{''}{'guser7'} }, (); 109 push @{ $repos{''}{'guser70'} }, (); 110 push @{ $repos{''}{'guser71'} }, (); 111 push @{ $repos{''}{'guser72'} }, (); 112 push @{ $repos{''}{'guser73'} }, (); 113 push @{ $repos{''}{'guser74'} }, (); 114 push @{ $repos{''}{'guser75'} }, (); 115 push @{ $repos{''}{'guser76'} }, (); 116 push @{ $repos{''}{'guser77'} }, (); 117 push @{ $repos{''}{'guser78'} }, (); 118 push @{ $repos{''}{'guser79'} }, (); 119 push @{ $repos{''}{'guser8'} }, (); 120 push @{ $repos{''}{'guser80'} }, (); 121 push @{ $repos{''}{'guser81'} }, (); 122 push @{ $repos{''}{'guser82'} }, (); 123 push @{ $repos{''}{'guser83'} }, (); 124 push @{ $repos{''}{'guser84'} }, (); 125 push @{ $repos{''}{'guser85'} }, (); 126 push @{ $repos{''}{'guser9'} }, (); 127 push @{ $repos{''}{'user1'} }, (); 128 push @{ $repos{''}{'user10'} }, (); 129 push @{ $repos{''}{'user11'} }, (); 130 push @{ $repos{''}{'user12'} }, (); 131 push @{ $repos{''}{'user13'} }, (); 132 push @{ $repos{''}{'user14'} }, (); 133 push @{ $repos{''}{'user15'} }, (); 134 push @{ $repos{''}{'user16'} }, (); 135 push @{ $repos{''}{'user2'} }, (); 136 push @{ $repos{''}{'user3'} }, (); 137 push @{ $repos{''}{'user4'} }, (); 138 push @{ $repos{''}{'user5'} }, (); 139 push @{ $repos{''}{'user6'} }, (); 140 push @{ $repos{''}{'user7'} }, (); 141 $repos{''}{R}{'user8'} = 1; 142 $repos{''}{W}{'user8'} = 1; 143 push @{ $repos{''}{'user8'} }, (); 144 return %repos; 145} 146