summaryrefslogtreecommitdiff
path: root/dist/Data-Dumper/t/perl-74170.t
blob: 4f8025dcacb21a6e407d1824660530b653a553a8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#!perl -X
#
# Regression test for [perl #74170] (missing SPAGAIN after DD_Dump(...)):
# Since it’s so large, it gets its own file.

BEGIN {
    require Config; import Config;
    no warnings 'once';
    if ($Config{'extensions'} !~ /\bData\/Dumper\b/) {
	print "1..0 # Skip: Data::Dumper was not built\n";
	exit 0;
    }
}

use strict;
use Test::More tests => 1;
use Data::Dumper;

our %repos = ();
&real_life_setup();

$Data::Dumper::Indent = 1;
# A custom sort sub is necessary for reproducing the bug, as this is where
# the stack gets reallocated.
$Data::Dumper::Sortkeys = sub { return [ reverse sort keys %{$_[0]} ]; }
    unless exists $ENV{NO_SORT_SUB};

ok +Data::Dumper->Dumpxs([\%repos], [qw(*repos)]);

sub real_life_setup {
    # set up the %repos hash in a manner that reflects a real run of
    # gitolite's "compiler" script:
    # Yes, all this is necessary to get the stack in such a state that the
    # custom sort sub will trigger a reallocation.
    push @{ $repos{''}{'@all'} }, ();
    push @{ $repos{''}{'guser86'} }, ();
    push @{ $repos{''}{'guser87'} }, ();
    push @{ $repos{''}{'user88'} }, ();
    push @{ $repos{''}{'grussell'} }, ();
    push @{ $repos{''}{'guser0'} }, ();
    push @{ $repos{''}{'guser1'} }, ();
    push @{ $repos{''}{'guser10'} }, ();
    push @{ $repos{''}{'guser11'} }, ();
    push @{ $repos{''}{'guser12'} }, ();
    push @{ $repos{''}{'guser13'} }, ();
    push @{ $repos{''}{'guser14'} }, ();
    push @{ $repos{''}{'guser15'} }, ();
    push @{ $repos{''}{'guser16'} }, ();
    push @{ $repos{''}{'guser17'} }, ();
    push @{ $repos{''}{'guser18'} }, ();
    push @{ $repos{''}{'guser19'} }, ();
    push @{ $repos{''}{'guser2'} }, ();
    push @{ $repos{''}{'guser20'} }, ();
    push @{ $repos{''}{'guser21'} }, ();
    push @{ $repos{''}{'guser22'} }, ();
    push @{ $repos{''}{'guser23'} }, ();
    push @{ $repos{''}{'guser24'} }, ();
    push @{ $repos{''}{'guser25'} }, ();
    push @{ $repos{''}{'guser26'} }, ();
    push @{ $repos{''}{'guser27'} }, ();
    push @{ $repos{''}{'guser28'} }, ();
    push @{ $repos{''}{'guser29'} }, ();
    push @{ $repos{''}{'guser3'} }, ();
    push @{ $repos{''}{'guser30'} }, ();
    push @{ $repos{''}{'guser31'} }, ();
    push @{ $repos{''}{'guser32'} }, ();
    push @{ $repos{''}{'guser33'} }, ();
    push @{ $repos{''}{'guser34'} }, ();
    push @{ $repos{''}{'guser35'} }, ();
    push @{ $repos{''}{'guser36'} }, ();
    push @{ $repos{''}{'guser37'} }, ();
    push @{ $repos{''}{'guser38'} }, ();
    push @{ $repos{''}{'guser39'} }, ();
    push @{ $repos{''}{'guser4'} }, ();
    push @{ $repos{''}{'guser40'} }, ();
    push @{ $repos{''}{'guser41'} }, ();
    push @{ $repos{''}{'guser42'} }, ();
    push @{ $repos{''}{'guser43'} }, ();
    push @{ $repos{''}{'guser44'} }, ();
    push @{ $repos{''}{'guser45'} }, ();
    push @{ $repos{''}{'guser46'} }, ();
    push @{ $repos{''}{'guser47'} }, ();
    push @{ $repos{''}{'guser48'} }, ();
    push @{ $repos{''}{'guser49'} }, ();
    push @{ $repos{''}{'guser5'} }, ();
    push @{ $repos{''}{'guser50'} }, ();
    push @{ $repos{''}{'guser51'} }, ();
    push @{ $repos{''}{'guser52'} }, ();
    push @{ $repos{''}{'guser53'} }, ();
    push @{ $repos{''}{'guser54'} }, ();
    push @{ $repos{''}{'guser55'} }, ();
    push @{ $repos{''}{'guser56'} }, ();
    push @{ $repos{''}{'guser57'} }, ();
    push @{ $repos{''}{'guser58'} }, ();
    push @{ $repos{''}{'guser59'} }, ();
    push @{ $repos{''}{'guser6'} }, ();
    push @{ $repos{''}{'guser60'} }, ();
    push @{ $repos{''}{'guser61'} }, ();
    push @{ $repos{''}{'guser62'} }, ();
    push @{ $repos{''}{'guser63'} }, ();
    push @{ $repos{''}{'guser64'} }, ();
    push @{ $repos{''}{'guser65'} }, ();
    push @{ $repos{''}{'guser66'} }, ();
    push @{ $repos{''}{'guser67'} }, ();
    push @{ $repos{''}{'guser68'} }, ();
    push @{ $repos{''}{'guser69'} }, ();
    push @{ $repos{''}{'guser7'} }, ();
    push @{ $repos{''}{'guser70'} }, ();
    push @{ $repos{''}{'guser71'} }, ();
    push @{ $repos{''}{'guser72'} }, ();
    push @{ $repos{''}{'guser73'} }, ();
    push @{ $repos{''}{'guser74'} }, ();
    push @{ $repos{''}{'guser75'} }, ();
    push @{ $repos{''}{'guser76'} }, ();
    push @{ $repos{''}{'guser77'} }, ();
    push @{ $repos{''}{'guser78'} }, ();
    push @{ $repos{''}{'guser79'} }, ();
    push @{ $repos{''}{'guser8'} }, ();
    push @{ $repos{''}{'guser80'} }, ();
    push @{ $repos{''}{'guser81'} }, ();
    push @{ $repos{''}{'guser82'} }, ();
    push @{ $repos{''}{'guser83'} }, ();
    push @{ $repos{''}{'guser84'} }, ();
    push @{ $repos{''}{'guser85'} }, ();
    push @{ $repos{''}{'guser9'} }, ();
    push @{ $repos{''}{'user1'} }, ();
    push @{ $repos{''}{'user10'} }, ();
    push @{ $repos{''}{'user11'} }, ();
    push @{ $repos{''}{'user12'} }, ();
    push @{ $repos{''}{'user13'} }, ();
    push @{ $repos{''}{'user14'} }, ();
    push @{ $repos{''}{'user15'} }, ();
    push @{ $repos{''}{'user16'} }, ();
    push @{ $repos{''}{'user2'} }, ();
    push @{ $repos{''}{'user3'} }, ();
    push @{ $repos{''}{'user4'} }, ();
    push @{ $repos{''}{'user5'} }, ();
    push @{ $repos{''}{'user6'} }, ();
    push @{ $repos{''}{'user7'} }, ();
    $repos{''}{R}{'user8'} = 1;
    $repos{''}{W}{'user8'} = 1;
    push @{ $repos{''}{'user8'} }, ();
}