bingos/devel-patchperl

Fails to patch 5.20.3

xdg opened this issue · 2 comments

xdg commented

Run against https://cpan.metacpan.org/authors/id/S/SH/SHAY/perl-5.20.3.tar.gz:

$ patchperl
Auto-guessed '5.20.3'
patching Configure
patching utils/h2ph.PL
2 out of 2 hunks FAILED -- saving rejects to file utils/h2ph.PL.rej
Died at /Users/david/.plenv/versions/28.1t/lib/perl5/site_perl/5.28.1/Devel/PatchPerl.pm line 416.

Reject file:

***************
*** 788,793 ****
  
      open  PREAMBLE, ">$preamble" or die "Cannot open $preamble:  $!";
  	print PREAMBLE "# This file was created by h2ph version $VERSION\n";
  
  	foreach (sort keys %define) {
  	    if ($opt_D) {
--- 788,798 ----
  
      open  PREAMBLE, ">$preamble" or die "Cannot open $preamble:  $!";
  	print PREAMBLE "# This file was created by h2ph version $VERSION\n";
+         # Prevent non-portable hex constants from warning.
+         #
+         # We still produce an overflow warning if we can't represent
+         # a hex constant as an integer.
+         print PREAMBLE "no warnings qw(portable);\n";
  
  	foreach (sort keys %define) {
  	    if ($opt_D) {
***************
*** 814,819 ****
  		# integer:
  		print PREAMBLE
  		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
  	    } elsif ($define{$_} =~ /^\w+$/) {
  		my $def = $define{$_};
  		if ($isatype{$def}) {
--- 819,836 ----
  		# integer:
  		print PREAMBLE
  		    "unless (defined &$_) { sub $_() { $1 } }\n\n";
+             } elsif ($define{$_} =~ /^([+-]?0x[\da-f]+)U?L{0,2}$/i) {
+                 # hex integer
+                 # Special cased, since perl warns on hex integers
+                 # that can't be represented in a UV.
+                 #
+                 # This way we get the warning at time of use, so the user
+                 # only gets the warning if they happen to use this
+                 # platform-specific definition.
+                 my $code = $1;
+                 $code = "hex('$code')" if length $code > 10;
+                 print PREAMBLE
+                     "unless (defined &$_) { sub $_() { $code } }\n\n";
  	    } elsif ($define{$_} =~ /^\w+$/) {
  		my $def = $define{$_};
  		if ($isatype{$def}) {

Just uploaded version 1.64 to CPAN which resolves this issue.

xdg commented

Thanks!