blib/lib/Devel/PatchPerl/Plugin/Darwin.pm untested

filter: Statementstmt 0.0% 0 / 114 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 24 Podpod 0.0% 0 / 20 totaltotal 0.0% 0 / 160 CC 2 SCAR 8.4
CC
2
Cov
0%
patchperl
6.0
_patch_pwent_test561
2.0
_patch_h2ph_pht560
2.0
CRAP 2.3
1 package Devel::PatchPerl::Plugin::Darwin;
2  
3 require Devel::PatchPerl;
4  
5 use strict;
6 use warnings;
7 use version;
8  
9 our $VERSION = 'v0.1.2';
10  
11 my @patch = (
12 {
13 perl => [ '5.6.0' ],
14 subs => [ [ \&_patch_h2ph_pht560 ], [ \&_patch_h2ph_h560 ], [ \&_patch_h2ph560 ] ],
15 },
16 {
17 perl => [ qr/^5\.6\.[1-2]$/ ],
18 subs => [ [ \&_patch_darwin_locale_test561 ], [ \&_patch_x2p_util561 ], [ \&_patch_timelocal_test561 ],
19 [ \&_patch_h2ph_pht560 ], [ \&_patch_h2ph_h560 ], [ \&_patch_h2ph560 ], [ \&_patch_pwent_test561 ] ],
20 },
21 {
22 perl => [ qw/5.8.9 5.10.1 5.11.0/, qr/^5\.9\.[0-5]$/ ],
23 subs => [ [ \&_patch_darwin_locale_test589 ] ],
24 },
25 {
26 perl => [ qr/^5\.11\.[1-5]$/, qr/^5\.12\.[0-4]/, '5.13.0' ],
27 subs => [ [ \&_patch_darwin_locale_test5111 ] ],
28 },
29 {
30 perl => [ '5.12.5', qr/^5\.14\.[0-4]/ ],
31 subs => [ [ \&_patch_darwin_locale_test5125 ] ],
32 },
33 {
34 perl => [ qr/^5\.13\.[1-9]$/, qr/^5\.13\.(10|11)/ ],
35 subs => [ [ \&_patch_darwin_locale_test5131 ] ],
36 },
37 {
38 perl => [ qr/^5\.15\.[0-7]$/ ],
39 subs => [ [ \&_patch_darwin_locale_test5150 ] ],
40 },
41 {
42 perl => [ qr/^5\.15\.[89]$/, qr/^5\.16\.[0-3]$/, qr/^5\.17\.\d+/, qr/^5\.18\.[0-4]$/, qr/^5\.19\.[0-8]/ ],
43 subs => [ [ \&_patch_darwin_locale_test5158 ] ],
44 },
45 {
46 perl => [ qr/^5\.18\.[0-4]$/ ],
47  
48 subs => [ [ \&_patch_darwin_gdbm_fatal_test5180 ] ],
49 },
50 {
51 perl => [ qr/^5\.22\.[34]$/ ],
52 subs => [ [ \&_patch_darwin_customized_dat5223 ] ],
53 },
54 {
55 perl => [ qr/^5\.22\.[0-4]$/, qr/^5\.23\.[0-9]$/, qr/^5\.24\.[0-4]$/ ],
56 subs => [ [ \&_patch_darwin_libperl_test5230 ] ],
57 },
58 {
59 perl => [ qr/^5\.24\.[1-4]$/ ],
60 subs => [ [ \&_patch_darwin_customized_dat5241 ] ],
61 },
62 {
63 perl => [ qr/^5\.25\.]d+/, qr/^5\.26\.[0-3]$/, qr/^5\.27\.\d+/, qr/^5\.28\.[0-3]$/ ],
64 subs => [ [ \&_patch_darwin_libperl_test5250 ] ],
65 },
66 {
67 perl => [ qr/^5\.30\.\d+/, qr/^5\.32\.\d+/, qr/^5\.33\.0/ ],
68 subs => [ [ \&_patch_darwin_libperl_test5300 ] ],
69 },
70 );
71  
72 sub patchperl {
73 my $class = shift;
74 my %args = @_;
75 my ($vers, $source, $patchexe) = @args{'version', 'source', 'patchexe'};
76 for my $p ( grep { Devel::PatchPerl::_is( $_->{perl}, $vers ) } @patch) {
77 for my $s (@{$p->{subs}}) {
78 my($sub, @args) = @$s;
79 push @args, $vers unless scalar @args;
80 $sub->(@args);
81 }
82 }
83 }
84  
85 sub _patch_pwent_test561 {
86 my $patch = <<'END';
87 --- t/op/pwent.t
88 +++ t/op/pwent.t
89 @@ -1,5 +1,7 @@
90 #!./perl
91  
92 +my $data;
93 +
94 BEGIN {
95 chdir 't' if -d 't';
96 @INC = '../lib';
97 @@ -41,6 +43,47 @@ BEGIN {
98 }
99 }
100  
101 + if (not defined $where && $^O eq 'darwin') {
102 + my %want = do {
103 + my $inx = 0;
104 + map {$_ => {inx => $inx++, mung => sub {$_[0]}}}
105 + qw{RecordName Password UniqueID PrimaryGroupID
106 + RealName NFSHomeDirectory UserShell};
107 + };
108 + $want{RecordName}{mung} = sub {(split '\s+', $_[0], 2)[0]};
109 + $want{UniqueID}{mung} = $want{PrimaryGroupID}{mung} = sub {
110 + unpack 'L', pack 'l', $_[0]};
111 + foreach my $dscl (qw(/usr/bin/dscl)) {
112 + -x $dscl or next;
113 + open (my $fh, '-|', join (' ', $dscl, qw{. -readall /Users},
114 + keys %want, '2>/dev/null')) or next;
115 + my @rec;
116 + while (<$fh>) {
117 + chomp;
118 + if ($_ eq '-') {
119 + @rec and $data .= join (':', @rec) . "\n";
120 + @rec = ();
121 + next;
122 + }
123 + my ($name, $value) = split ':\s+', $_, 2;
124 + unless (defined $value) {
125 + s/:$//;
126 + $name = $_;
127 + $value = <$fh>;
128 + chomp $value;
129 + $value =~ s/^\s+//;
130 + }
131 + if (defined (my $info = $want{$name})) {
132 + $rec[$info->{inx}] = $info->{mung}->($value);
133 + }
134 + }
135 + @rec and $data .= join (':', @rec) . "\n";
136 + $where = "dscl . -readall /Users";
137 + undef $reason;
138 + last;
139 + }
140 + }
141 +
142 if (not defined $where) { # Try local.
143 my $PW = "/etc/passwd";
144 if (-f $PW && open(PW, $PW) && defined(<PW>)) {
145 @@ -69,51 +112,90 @@ my %perfect;
146 my %seen;
147  
148 setpwent();
149 -while (<PW>) {
150 - chomp;
151 - # LIMIT -1 so that users with empty shells don't fall off
152 - my @s = split /:/, $_, -1;
153 - my ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s);
154 - if ($^O eq 'darwin') {
155 - ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s[0,1,2,3,7,8,9];
156 - } else {
157 - ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s;
158 - }
159 - next if /^\+/; # ignore NIS includes
160 - if (@s) {
161 - push @{ $seen{$name_s} }, $.;
162 - } else {
163 - warn "# Your $where line $. is empty.\n";
164 - next;
165 - }
166 - if ($n == $max) {
167 - local $/;
168 - my $junk = <PW>;
169 - last;
170 - }
171 - # In principle we could whine if @s != 7 but do we know enough
172 - # of passwd file formats everywhere?
173 - if (@s == 7 || ($^O eq 'darwin' && @s == 10)) {
174 - @n = getpwuid($uid_s);
175 - # 'nobody' et al.
176 - next unless @n;
177 - my ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$home,$shell) = @n;
178 - # Protect against one-to-many and many-to-one mappings.
179 - if ($name_s ne $name) {
180 - @n = getpwnam($name_s);
181 - ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$home,$shell) = @n;
182 - next if $name_s ne $name;
183 - }
184 - $perfect{$name_s}++
185 - if $name eq $name_s and
186 - $uid eq $uid_s and
187 -# Do not compare passwords: think shadow passwords.
188 - $gid eq $gid_s and
189 - $gcos eq $gcos_s and
190 - $home eq $home_s and
191 - $shell eq $shell_s;
192 +
193 +if ($^O eq 'darwin') {
194 + my @lines = split(/\n/, $data);
195 + foreach my $line (@lines) {
196 + my @s = split /:/, $line, -1;
197 + my ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s;
198 + next if /^\+/; # ignore NIS includes
199 + if (@s) {
200 + push @{ $seen{$name_s} }, $.;
201 + } else {
202 + warn "# Your $where line $. is empty.\n";
203 + next;
204 + }
205 + if ($n == $max) {
206 + local $/;
207 + my $junk = <PW>;
208 + last;
209 + }
210 + if (@s == 7 || ($^O eq 'darwin' && @s == 10)) {
211 + @n = getpwuid($uid_s);
212 + next unless @n;
213 + my ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$home,$shell) = @n;
214 + if ($name_s ne $name) {
215 + @n = getpwnam($name_s);
216 + ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$home,$shell) = @n;
217 + next if $name_s ne $name;
218 + }
219 + $perfect{$name_s}++
220 + if $name eq $name_s and
221 + $uid eq $uid_s and
222 + $gid eq $gid_s and
223 + $gcos eq $gcos_s and
224 + $home eq $home_s and
225 + $shell eq $shell_s;
226 + }
227 + $n++;
228 + }
229 +} else {
230 + while (<PW>) {
231 + chomp;
232 + # LIMIT -1 so that users with empty shells don't fall off
233 + my @s = split /:/, $_, -1;
234 + my ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s);
235 + if ($^O eq 'darwin') {
236 + ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s[0,1,2,3,7,8,9];
237 + } else {
238 + ($name_s, $passwd_s, $uid_s, $gid_s, $gcos_s, $home_s, $shell_s) = @s;
239 + }
240 + next if /^\+/; # ignore NIS includes
241 + if (@s) {
242 + push @{ $seen{$name_s} }, $.;
243 + } else {
244 + warn "# Your $where line $. is empty.\n";
245 + next;
246 + }
247 + if ($n == $max) {
248 + local $/;
249 + my $junk = <PW>;
250 + last;
251 + }
252 + # In principle we could whine if @s != 7 but do we know enough
253 + # of passwd file formats everywhere?
254 + if (@s == 7 || ($^O eq 'darwin' && @s == 10)) {
255 + @n = getpwuid($uid_s);
256 + # 'nobody' et al.
257 + next unless @n;
258 + my ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$home,$shell) = @n;
259 + # Protect against one-to-many and many-to-one mappings.
260 + if ($name_s ne $name) {
261 + @n = getpwnam($name_s);
262 + ($name,$passwd,$uid,$gid,$quota,$comment,$gcos,$home,$shell) = @n;
263 + next if $name_s ne $name;
264 + }
265 + $perfect{$name_s}++
266 + if $name eq $name_s and
267 + $uid eq $uid_s and
268 + # Do not compare passwords: think shadow passwords.
269 + $gid eq $gid_s and
270 + $gcos eq $gcos_s and
271 + $home eq $home_s and
272 + $shell eq $shell_s;
273 + }
274 + $n++;
275 }
276 - $n++;
277 }
278 endpwent();
279 END
280 Devel::PatchPerl::_patch($patch);
281 }
282  
283 sub _patch_h2ph_pht560 {
284 my $patch = <<'END';
285 --- t/lib/h2ph.pht
286 +++ t/lib/h2ph.pht
287 @@ -29,7 +29,7 @@ unless(defined(&_H2PH_H_)) {
288 if(!(defined (defined(&__SOMETHING_MORE_IMPORTANT) ? &__SOMETHING_MORE_IMPORTANT : 0))) {
289 }
290 elsif(!(defined (defined(&__SOMETHING_REALLY_REALLY_IMPORTANT) ? &__SOMETHING_REALLY_REALLY_IMPORTANT : 0))) {
291 - die("Nup\,\ can\'t\ go\ on\ ");
292 + die("Nup, can't go on");
293 } else {
294 eval 'sub EVERYTHING_IS_OK () {1;}' unless defined(&EVERYTHING_IS_OK);
295 }
296 @@ -49,7 +49,7 @@ unless(defined(&_H2PH_H_)) {
297 require 'sys/ioctl.ph';
298 eval {
299 my(%INCD) = map { $INC{$_} => 1 } (grep { $_ eq "sys/fcntl.ph" } keys(%INC));
300 - my(@REM) = map { "$_/sys/fcntl.ph" } (grep { not exists($INCD{"$_/sys/fcntl.ph"})and -f "$_/sys/fcntl.ph" } @INC);
301 + my(@REM) = map { "$_/sys/fcntl.ph" } (grep { not exists($INCD{"$_/sys/fcntl.ph"}) and -f "$_/sys/fcntl.ph" } @INC);
302 require "$REM[0]" if @REM;
303 };
304 warn($@) if $@;
305 END
306 Devel::PatchPerl::_patch($patch);
307 }
308  
309 sub _patch_h2ph_h560 {
310 my $patch = <<'END';
311 --- t/lib/h2ph.h
312 +++ t/lib/h2ph.h
313 @@ -38,7 +38,7 @@
314 #if !(defined __SOMETHING_MORE_IMPORTANT)
315 # warn Be careful...
316 #elif !(defined __SOMETHING_REALLY_REALLY_IMPORTANT)
317 -# error Nup, can't go on /* ' /* stupid font-lock-mode */
318 +# error "Nup, can't go on" /* ' /* stupid font-lock-mode */
319 #else /* defined __SOMETHING_MORE_IMPORTANT && defined __SOMETHING_REALLY_REALLY_IMPORTANT */
320 # define EVERYTHING_IS_OK
321 #endif
322 END
323 Devel::PatchPerl::_patch($patch);
324 }
325  
326 sub _patch_h2ph560 {
327 my $patch = <<'END';
328 --- utils/h2ph.PL.orig 2021-02-14 16:41:47.000000000 +0900
329 +++ utils/h2ph.PL 2021-02-14 16:43:37.000000000 +0900
330 @@ -120,9 +120,7 @@ while (defined (my $file = next_file()))
331 open(OUT,">$Dest_dir/$outfile") || die "Can't create $outfile: $!\n";
332 }
333  
334 - print OUT
335 - "require '_h2ph_pre.ph';\n\n",
336 - "no warnings 'redefine';\n\n";
337 + print OUT "require '_h2ph_pre.ph';\n\n";
338  
339 while (defined (local $_ = next_line($file))) {
340 if (s/^\s*\#\s*//) {
341 @@ -195,19 +193,18 @@ while (defined (my $file = next_file()))
342 "eval {\n");
343 $tab += 4;
344 $t = "\t" x ($tab / 8) . ' ' x ($tab % 8);
345 - print OUT ($t, "my(\@REM);\n");
346 if ($incl_type eq 'include_next') {
347 print OUT ($t,
348 "my(\%INCD) = map { \$INC{\$_} => 1 } ",
349 "(grep { \$_ eq \"$incl\" } ",
350 "keys(\%INC));\n");
351 print OUT ($t,
352 - "\@REM = map { \"\$_/$incl\" } ",
353 + "my(\@REM) = map { \"\$_/$incl\" } ",
354 "(grep { not exists(\$INCD{\"\$_/$incl\"})",
355 " and -f \"\$_/$incl\" } \@INC);\n");
356 } else {
357 print OUT ($t,
358 - "\@REM = map { \"\$_/$incl\" } ",
359 + "my(\@REM) = map { \"\$_/$incl\" } ",
360 "(grep {-r \"\$_/$incl\" } \@INC);\n");
361 }
362 print OUT ($t,
363 @@ -436,7 +433,7 @@ sub expr {
364 }
365 } else {
366 if ($inif && $new !~ /defined\s*\($/) {
367 - $new .= '(defined(&' . $id . ') ? &' . $id . ' : undef)';
368 + $new .= '(defined(&' . $id . ') ? &' . $id . ' : 0)';
369 } elsif (/^\[/) {
370 $new .= " \$$id";
371 } else {
372 END
373 Devel::PatchPerl::_patch($patch);
374 }
375  
376 sub _patch_x2p_util561 {
377 my $patch = <<'END';
378 --- x2p/util.c
379 +++ x2p/util.c
380 @@ -204,7 +204,7 @@ fatal(char *pat,...)
381 }
382  
383 #if defined(__APPLE_CC__)
384 -__private_extern__ /* warn() conflicts with libc */
385 +__private_extern__; /* warn() conflicts with libc */
386 #endif
387 void
388 warn(char *pat,...)
389 END
390 Devel::PatchPerl::_patch($patch);
391 }
392  
393 sub _patch_timelocal_test561 {
394 my $patch = <<'END';
395 --- t/lib/timelocal.t
396 +++ t/lib/timelocal.t
397 @@ -27,11 +27,12 @@ print "1..", @time * 2 + 5, "\n";
398 $count = 1;
399 for (@time) {
400 my($year, $mon, $mday, $hour, $min, $sec) = @$_;
401 - $year -= 1900;
402 + $year -= 1900 if ($year < 1900);
403 $mon --;
404 my $time = timelocal($sec,$min,$hour,$mday,$mon,$year);
405 # print scalar(localtime($time)), "\n";
406 my($s,$m,$h,$D,$M,$Y) = localtime($time);
407 + $Y += 1900;
408  
409 if ($s == $sec &&
410 $m == $min &&
411 @@ -50,6 +51,7 @@ for (@time) {
412 $time = timegm($sec,$min,$hour,$mday,$mon,$year);
413 ($s,$m,$h,$D,$M,$Y) = gmtime($time);
414  
415 + $Y += 1900;
416 if ($s == $sec &&
417 $m == $min &&
418 $h == $hour &&
419 END
420 Devel::PatchPerl::_patch($patch);
421 }
422  
423 sub _patch_darwin_locale_test561 {
424 my $patch = <<'END';
425 --- t/pragma/locale.t
426 +++ t/pragma/locale.t
427 @@ -424,6 +424,19 @@ if (-x "/usr/bin/locale" && open(LOCALES
428  
429 setlocale(LC_ALL, "C");
430  
431 +if ($^O eq 'darwin') {
432 + # Darwin 8/Mac OS X 10.4 and 10.5 have bad Basque locales: perl bug #35895,
433 + # Apple bug ID# 4139653. It also has a problem in Byelorussian.
434 + (my $v) = $Config{osvers} =~ /^(\d+)/;
435 + if ($v >= 8 and $v < 10) {
436 + debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
437 + @Locale = grep ! m/^(eu_ES(?:\..*)?|be_BY\.CP1131)$/, @Locale;
438 + } else {
439 + debug "# Skipping be_BY locales -- buggy in Darwin\n";
440 + @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
441 + }
442 +}
443 +
444 sub utf8locale { $_[0] =~ /utf-?8/i }
445  
446 @Locale = sort @Locale;
447 END
448 Devel::PatchPerl::_patch($patch);
449 }
450  
451 sub _patch_darwin_locale_test589 {
452 my $patch = <<'END';
453 --- lib/locale.t
454 +++ lib/locale.t
455 @@ -460,6 +460,9 @@ if ($^O eq 'darwin') {
456 if ($v >= 8 and $v < 10) {
457 debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
458 @Locale = grep ! m/^(eu_ES|be_BY.CP1131$)/, @Locale;
459 + } else {
460 + debug "# Skipping be_BY locales -- buggy in Darwin\n";
461 + @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
462 }
463 }
464 END
465 Devel::PatchPerl::_patch($patch);
466 }
467  
468 sub _patch_darwin_locale_test5111 {
469 my $patch = <<'END';
470 --- lib/locale.t
471 +++ lib/locale.t
472 @@ -460,7 +460,7 @@ if ($^O eq 'darwin') {
473 if ($v >= 8 and $v < 10) {
474 debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
475 @Locale = grep ! m/^(eu_ES|be_BY\.CP1131)$/, @Locale;
476 - } elsif ($v < 11) {
477 + } else {
478 debug "# Skipping be_BY locales -- buggy in Darwin\n";
479 @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
480 }
481 END
482 Devel::PatchPerl::_patch($patch);
483 }
484  
485 sub _patch_darwin_locale_test5125 {
486 my $patch = <<'END';
487 --- lib/locale.t
488 +++ lib/locale.t
489 @@ -460,7 +460,7 @@ if ($^O eq 'darwin') {
490 if ($v >= 8 and $v < 10) {
491 debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
492 @Locale = grep ! m/^(eu_ES(?:\..*)?|be_BY\.CP1131)$/, @Locale;
493 - } elsif ($v < 13) {
494 + } else {
495 debug "# Skipping be_BY locales -- buggy in Darwin\n";
496 @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
497 }
498 END
499 Devel::PatchPerl::_patch($patch);
500 }
501  
502 sub _patch_darwin_locale_test5131 {
503 my $patch = <<'END';
504 --- lib/locale.t
505 +++ lib/locale.t
506 @@ -460,7 +460,7 @@ if ($^O eq 'darwin') {
507 if ($v >= 8 and $v < 10) {
508 debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
509 @Locale = grep ! m/^(eu_ES(?:\..*)?|be_BY\.CP1131)$/, @Locale;
510 - } elsif ($v < 11) {
511 + } else {
512 debug "# Skipping be_BY locales -- buggy in Darwin\n";
513 @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
514 }
515 END
516 Devel::PatchPerl::_patch($patch);
517 }
518  
519 sub _patch_darwin_locale_test5150 {
520 my $patch = <<'END';
521 --- lib/locale.t
522 +++ lib/locale.t
523 @@ -460,7 +460,7 @@ if ($^O eq 'darwin') {
524 if ($v >= 8 and $v < 10) {
525 debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
526 @Locale = grep ! m/^(eu_ES(?:\..*)?|be_BY\.CP1131)$/, @Locale;
527 - } elsif ($v < 12) {
528 + } else {
529 debug "# Skipping be_BY locales -- buggy in Darwin\n";
530 @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
531 }
532 END
533 Devel::PatchPerl::_patch($patch);
534 }
535  
536 sub _patch_darwin_locale_test5158 {
537 my $patch = <<'END';
538 --- lib/locale.t
539 +++ lib/locale.t
540 @@ -648,7 +648,7 @@ if ($^O eq 'darwin') {
541 if ($v >= 8 and $v < 10) {
542 debug "# Skipping eu_ES, be_BY locales -- buggy in Darwin\n";
543 @Locale = grep ! m/^(eu_ES(?:\..*)?|be_BY\.CP1131)$/, @Locale;
544 - } elsif ($v < 12) {
545 + } else {
546 debug "# Skipping be_BY locales -- buggy in Darwin\n";
547 @Locale = grep ! m/^be_BY\.CP1131$/, @Locale;
548 }
549 END
550 Devel::PatchPerl::_patch($patch);
551 }
552  
553 sub _patch_darwin_gdbm_fatal_test5180 {
554 my $patch = <<'END';
555 --- ext/GDBM_File/t/fatal.t
556 +++ ext/GDBM_File/t/fatal.t
557 @@ -30,16 +30,21 @@ isnt((open $fh, "<&=$fileno"), undef, "d
558 or diag("\$! = $!");
559 isnt(close $fh, undef,
560 "close fileno $fileno, out from underneath the GDBM_File");
561 -is(eval {
562 +my $res = eval {
563 $h{Perl} = 'Rules';
564 untie %h;
565 - 1;
566 -}, undef, 'Trapped error when attempting to write to knobbled GDBM_File');
567 + 99;
568 +};
569  
570 -# Observed "File write error" and "lseek error" from two different systems.
571 -# So there might be more variants. Important part was that we trapped the error
572 -# via croak.
573 -like($@, qr/ at .*\bfatal\.t line \d+\.\n\z/,
574 - 'expected error message from GDBM_File');
575 +SKIP: {
576 + skip "Can't trigger failure", 2 if $res == 99;
577 + is $res, undef, "eval should return undef";
578 +
579 + # Observed "File write error" and "lseek error" from two different systems.
580 + # So there might be more variants. Important part was that we trapped the error
581 + # via croak.
582 + like($@, qr/ at .*\bfatal\.t line \d+\.\n\z/,
583 + 'expected error message from GDBM_File');
584 +}
585  
586 unlink <Op_dbmx*>;
587 END
588 Devel::PatchPerl::_patch($patch);
589 }
590  
591 sub _patch_darwin_libperl_test5230 {
592 my $patch = <<'END';
593 --- t/porting/libperl.t
594 +++ t/porting/libperl.t
595 @@ -550,7 +550,7 @@ if (defined $nm_err_tmp) {
596 while (<$nm_err_fh>) {
597 # OS X has weird error where nm warns about
598 # "no name list" but then outputs fine.
599 - if (/nm: no name list/ && $^O eq 'darwin') {
600 + if ((/nm: no name list/ || /^no symbols$/) && $^O eq 'darwin') {
601 print "# $^O ignoring $nm output: $_";
602 next;
603 }
604 END
605 Devel::PatchPerl::_patch($patch);
606 }
607  
608 sub _patch_darwin_customized_dat5223 {
609 my $patch = <<'END';
610 --- t/porting/customized.dat
611 +++ t/porting/customized.dat
612 @@ -20,7 +20,7 @@ ExtUtils::Command cpan/ExtUtils-Command/
613 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/bin/instmodsh 5bc04a0173b8b787f465271b6186220326ae8eef
614 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm 6298f9b41b29e13010b185f64fa952570637fbb4
615 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm 6e16329fb4d4c2f8db4afef4d8e79c1c1c918128
616 -ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm fc0483c5c7b92a8e0f63eb1f762172cddce5b948
617 +ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm 9239e2140e8d78d2d70802eff7ff07cb147bf0c6
618 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 8d1b35fcd7d3b4f0552ffb151baf75ccb181267b
619 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm 676b10e16b2dc68ba21312ed8aa4d409e86005a6
620 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod 757bffb47857521311f8f3bde43ebe165f8d5191
621 END
622 Devel::PatchPerl::_patch($patch);
623 }
624  
625 sub _patch_darwin_customized_dat5241 {
626 my $patch = <<'END';
627 --- t/porting/customized.dat
628 +++ t/porting/customized.dat
629 @@ -22,7 +22,7 @@ ExtUtils::MakeMaker cpan/ExtUtils-MakeMa
630 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command.pm e3a372e07392179711ea9972087c1105a2780fad
631 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Command/MM.pm b72721bd6aa9bf7ec328bda99a8fdb63cac6114d
632 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist.pm 0e1e4c25eddb999fec6c4dc66593f76db34cfd16
633 -ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm bfd2aa00ca4ed251f342e1d1ad704abbaf5a615e
634 +ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/Liblist/Kid.pm 47d2fdf890d7913ccd0e32b5f98a98f75745d227
635 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker.pm 5529ae3064365eafd99536621305d52f4ab31b45
636 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/Config.pm bc88b275af73b8faac6abd59a9aad3f625925810
637 ExtUtils::MakeMaker cpan/ExtUtils-MakeMaker/lib/ExtUtils/MakeMaker/FAQ.pod 062e5d14a803fbbec8d61803086a3d7997e8a473
638 END
639 Devel::PatchPerl::_patch($patch);
640 }
641  
642 sub _patch_darwin_libperl_test5250 {
643 my $patch = <<'END';
644 --- t/porting/libperl.t
645 +++ t/porting/libperl.t
646 @@ -241,7 +241,8 @@ sub nm_parse_gnu {
647 sub nm_parse_darwin {
648 my $symbols = shift;
649 my $line = $_;
650 - if (m{^(?:.+)?libperl\.a\((\w+\.o)\):$}) {
651 + if (m{^(?:.+)?libperl\.a\((\w+\.o)\):$} ||
652 + m{^(\w+\.o):$}) {
653 # object file name
654 $symbols->{obj}{$1}++;
655 $symbols->{o} = $1;
656 @@ -574,7 +575,7 @@ if (defined $nm_err_tmp) {
657 while (<$nm_err_fh>) {
658 # OS X has weird error where nm warns about
659 # "no name list" but then outputs fine.
660 - if (/nm: no name list/ && $^O eq 'darwin') {
661 + if ((/nm: no name list/ || /^no symbols$/) && $^O eq 'darwin') {
662 print "# $^O ignoring $nm output: $_";
663 next;
664 }
665 END
666 Devel::PatchPerl::_patch($patch);
667 }
668  
669 sub _patch_darwin_libperl_test5300 {
670 my $patch = <<'END';
671 --- t/porting/libperl.t
672 +++ t/porting/libperl.t
673 @@ -241,7 +241,8 @@ sub nm_parse_gnu {
674 sub nm_parse_darwin {
675 my $symbols = shift;
676 my $line = $_;
677 - if (m{^(?:.+)?libperl\.a\((\w+\.o)\):$}) {
678 + if (m{^(?:.+)?libperl\.a\((\w+\.o)\):$} ||
679 + m{^(\w+\.o):$}) {
680 # object file name
681 $symbols->{obj}{$1}++;
682 $symbols->{o} = $1;
683 END
684 Devel::PatchPerl::_patch($patch);
685 }
686  
687 1;
688  
689 __END__