Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 15a9a03

Browse files
committed
Storable 3.12_04: fix stacksize probe
Wrong end condition check on failure. Use proper cperl/perl.exe path for CreateProcess
1 parent 85c1f5d commit 15a9a03

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

Makefile.SH

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ esac
177177
: is Cwd static or dynamic
178178
static_cwd='define'
179179
cwd_dep='$(PERL_EXE)'
180-
storable_limit_dep=''
180+
storable_limit_dep='$(PERL_EXE)'
181181
storable_type=''
182182
list_util_dep='$(PERL_EXE)'
183183
for f in $dynamic_ext; do

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1283,7 +1283,7 @@ package Maintainers;
12831283
},
12841284

12851285
'Storable' => {
1286-
'DISTRIBUTION' => 'RURBAN/Storable-3.12_03.tar.gz',
1286+
'DISTRIBUTION' => 'RURBAN/Storable-3.12_04.tar.gz',
12871287
'FILES' => q[dist/Storable],
12881288
'EXCLUDED' => [
12891289
qw( ptr_table.h t/leaks_refcnt.t .travis.yml appveyor.yml ),

dist/Storable/Makefile.PL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ WriteMakefile(
3838
ABSTRACT_FROM => 'Storable_pm.PL',
3939
($ExtUtils::MakeMaker::VERSION > 6.45 ?
4040
(META_MERGE => { resources =>
41-
{ bugtracker => 'http://rt.perl.org/perlbug/',
41+
{ bugtracker => 'https://github.com/rurban/Storable/issues',
4242
repository => 'https://github.com/rurban/Storable/',
4343
},
4444
provides => {

dist/Storable/stacksize

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ if ($^O eq "MSWin32") {
4040
SetErrorMode(SEM_NOGPFAULTERRORBOX() | SEM_FAILCRITICALERRORS());
4141
}
4242
# the ; here is to ensure system() passes this to the shell
43-
elsif (system("ulimit -c 0 ;") == 0) {
43+
elsif (system("ulimit -c 0;") == 0) {
4444
# try to prevent core dumps
45-
$prefix = "ulimit -c 0 ; ";
45+
$prefix = "ulimit -c 0;";
4646
}
4747
if (@ARGV and $ARGV[0] eq '--core') {
4848
$ENV{PERL_CORE} = 1;
@@ -77,7 +77,7 @@ if ($^O eq "MSWin32") {
7777
my ($str, $major, $minor) = Win32::GetOSVersion();
7878
if ($major < 6 || $major == 6 && $minor < 1) {
7979
print "Using defaults for older Win32\n";
80-
write_limits(500, 256);
80+
write_limits(500, 250);
8181
exit;
8282
}
8383
}
@@ -114,29 +114,19 @@ if (PARALLEL) {
114114
sleep(2.0);
115115
}
116116

117-
my $use_W32J = 0;
118-
if ($^O eq 'MSWin32' && $^V ge v5.18.0) {
119-
eval { require Win32::Job;$use_W32J=1;}
120-
}
121117
sub runcmd {
122118
my $cmd = shift;
123-
unless ($use_W32J) {
124-
return `$cmd` =~ /\bok\b/ ? 0 : 1;
125-
}
126-
my $job = Win32::Job->new;
127-
my $pid = $job->spawn(q{perl}, $cmd);
128-
$job->run(5);
129-
my $status = $job->status;
130-
return $job->status->{$pid}{exitcode};
119+
return `$cmd` =~ /\bok\b/ ? 0 : 1;
131120
}
132121

133122
sub cmd {
134123
my ($i, $try, $limit_name) = @_;
135124
die unless $i;
136-
my $code = "my \$t; \$Storable::$limit_name = -1; $try for 1..$i;dclone(\$t); print qq/ok\n/";
125+
my $code = "my \$t; \$Storable::$limit_name = -1; " .
126+
"$try for 1..$i; dclone(\$t); print qq/ok\n/";
137127
my $q = ($^O eq 'MSWin32') ? '"' : "'";
138128

139-
"$prefix $PERL $mblib -MStorable=dclone -e$q$code$q"
129+
"$prefix$PERL $mblib -MStorable=dclone -e$q$code$q"
140130
}
141131
# try more
142132
sub good {
@@ -187,11 +177,15 @@ while (!$found) {
187177
$n = bad($n);
188178
}
189179
}
180+
if ($n == 100) {
181+
$n = 500;
182+
}
190183
print "MAX_DEPTH = $n\n" unless QUIET;
191184
my $max_depth = $n;
192185

193186
($n, $good, $bad, $found) =
194-
(int($n/2), 50, $n, undef);
187+
(int($n/2), $^O eq 'MSWin32' ? 32 : 50, $n, undef);
188+
my $good_orig = $good;
195189
# pack j only since 5.8
196190
my $max = ($] > 5.007 and length(pack "j", 0) < 8)
197191
? ($^O eq 'MSWin32' ? 3000 : 8000)
@@ -207,8 +201,8 @@ while (!$found) {
207201
$n = bad($n);
208202
}
209203
}
210-
if ($max_depth == $bad1-1
211-
and $n == $bad2-1)
204+
if (($max_depth == $bad1-1 and $n == $bad2-1)
205+
or ($n == $good_orig))
212206
{
213207
# more likely the shell. travis docker ubuntu, mingw e.g.
214208
print "Error: Apparently your system(SHELLSTRING) cannot catch stack overflows\n"

0 commit comments

Comments
 (0)