This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Errno: also escape osvers
authorTony Cook <tony@develop-help.com>
Wed, 7 Jun 2023 00:26:33 +0000 (10:26 +1000)
committerTony Cook <tony@develop-help.com>
Mon, 3 Jul 2023 04:10:04 +0000 (14:10 +1000)
Partly fixes #21135

Tested by Configuring with

  ... -Darchname='x86_64-linux@alpha' -Dosvers='4.19.0@beta'

ext/Errno/Errno_pm.PL

index ae647d5..77aa19b 100644 (file)
@@ -2,7 +2,7 @@ use ExtUtils::MakeMaker;
 use Config;
 use strict;
 
-our $VERSION = "1.37";
+our $VERSION = "1.38";
 
 my %err = ();
 
@@ -271,9 +271,9 @@ sub write_errno_pm {
        close(CPPO);
     }
 
-    # escape $Config{'archname'}
-    my $archname = $Config{'archname'};
-    $archname =~ s/([@%\$])/\\$1/g;
+    # escape $Config{'archname'}, $Config{'osvers'}
+    my ($archname, $osvers) = @Config{'archname', 'osvers'};
+    $_ = quotemeta for $archname, $osvers;
 
     # Write Errno.pm
 
@@ -297,8 +297,8 @@ EDQ
         print <<"CONFIG_CHECK_END";
 use Config;
 "\$Config{'archname'}-\$Config{'osvers'}" eq
-"$archname-$Config{'osvers'}" or
-       die "Errno architecture ($archname-$Config{'osvers'}) does not match executable architecture (\$Config{'archname'}-\$Config{'osvers'})";
+"$archname-$osvers" or
+       die "Errno architecture ($archname-$osvers) does not match executable architecture (\$Config{'archname'}-\$Config{'osvers'})";
 
 CONFIG_CHECK_END
 }