perl: 5.40.0 -> 5.42.0

Drop 0.38 and 5.40
This commit is contained in:
Marcus Ramberg
2025-11-15 19:32:26 +01:00
committed by Stig Palmquist
parent 750d1f0685
commit de6e69cd4a
10 changed files with 21 additions and 1044 deletions
@@ -1,26 +0,0 @@
commit 385e8759c3ff1e7f7f996bd4ea391074d61d48c1
Author: Karl Williamson <khw@cpan.org>
AuthorDate: 2024-12-18 18:25:29 -0700
Commit: Steve Hay <steve.m.hay@googlemail.com>
CommitDate: 2025-03-30 11:59:51 +0100
CVE-2024-56406: Heap-buffer-overflow with tr//
This was due to underallocating needed space. If the translation forces
something to become UTF-8 that is initially bytes, that UTF-8 could
now require two bytes where previously a single one would do.
(cherry picked from commit f93109c8a6950aafbd7488d98e112552033a3686)
diff --git a/op.c b/op.c
index 3fc23eca49a..aeee88e0335 100644
--- a/op.c
+++ b/op.c
@@ -6649,6 +6649,7 @@ S_pmtrans(pTHX_ OP *o, OP *expr, OP *repl)
* same time. But otherwise one crosses before the other */
if (t_cp < 256 && r_cp_end > 255 && r_cp != t_cp) {
can_force_utf8 = TRUE;
+ max_expansion = MAX(2, max_expansion);
}
}
@@ -1,408 +0,0 @@
From 918bfff86ca8d6d4e4ec5b30994451e0bd74aba9 Mon Sep 17 00:00:00 2001
From: Leon Timmermans <fawaka@gmail.com>
Date: Fri, 23 May 2025 15:40:41 +0200
Subject: [PATCH] CVE-2025-40909: Clone dirhandles without fchdir
This uses fdopendir and dup to dirhandles. This means it won't change
working directory during thread cloning, which prevents race conditions
that can happen if a third thread is active at the same time.
---
Configure | 6 ++
Cross/config.sh-arm-linux | 1 +
Cross/config.sh-arm-linux-n770 | 1 +
Porting/Glossary | 5 ++
Porting/config.sh | 1 +
config_h.SH | 6 ++
configure.com | 1 +
plan9/config_sh.sample | 1 +
sv.c | 91 +----------------------------
t/op/threads-dirh.t | 104 +--------------------------------
win32/config.gc | 1 +
win32/config.vc | 1 +
12 files changed, 28 insertions(+), 191 deletions(-)
diff --git a/Configure b/Configure
index 44c12ced4014..7a13249caa96 100755
--- a/Configure
+++ b/Configure
@@ -478,6 +478,7 @@ d_fd_set=''
d_fds_bits=''
d_fdclose=''
d_fdim=''
+d_fdopendir=''
d_fegetround=''
d_ffs=''
d_ffsl=''
@@ -13344,6 +13345,10 @@ esac
set i_fcntl
eval $setvar
+: see if fdopendir exists
+set fdopendir d_fdopendir
+eval $inlibc
+
: see if fork exists
set fork d_fork
eval $inlibc
@@ -25052,6 +25057,7 @@ d_flockproto='$d_flockproto'
d_fma='$d_fma'
d_fmax='$d_fmax'
d_fmin='$d_fmin'
+d_fdopendir='$d_fdopendir'
d_fork='$d_fork'
d_fp_class='$d_fp_class'
d_fp_classify='$d_fp_classify'
diff --git a/Cross/config.sh-arm-linux b/Cross/config.sh-arm-linux
index bfa0b00d5f0f..9e056539198b 100644
--- a/Cross/config.sh-arm-linux
+++ b/Cross/config.sh-arm-linux
@@ -212,6 +212,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir=undef
d_fds_bits='undef'
d_fegetround='define'
d_ffs='undef'
diff --git a/Cross/config.sh-arm-linux-n770 b/Cross/config.sh-arm-linux-n770
index 47ad5c37e3fd..365e4c4f9671 100644
--- a/Cross/config.sh-arm-linux-n770
+++ b/Cross/config.sh-arm-linux-n770
@@ -211,6 +211,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir=undef
d_fds_bits='undef'
d_fegetround='define'
d_ffs='undef'
diff --git a/Porting/Glossary b/Porting/Glossary
index bb505c653b0b..8b2965ca99c6 100644
--- a/Porting/Glossary
+++ b/Porting/Glossary
@@ -947,6 +947,11 @@ d_fmin (d_fmin.U):
This variable conditionally defines the HAS_FMIN symbol, which
indicates to the C program that the fmin() routine is available.
+d_fdopendir (d_fdopendir.U):
+ This variable conditionally defines the HAS_FORK symbol, which
+ indicates that the fdopen routine is available to open a
+ directory descriptor.
+
d_fork (d_fork.U):
This variable conditionally defines the HAS_FORK symbol, which
indicates to the C program that the fork() routine is available.
diff --git a/Porting/config.sh b/Porting/config.sh
index a921f7e1c79a..6231ea0f31ea 100644
--- a/Porting/config.sh
+++ b/Porting/config.sh
@@ -223,6 +223,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='define'
+d_fdopendir='define'
d_fds_bits='define'
d_fegetround='define'
d_ffs='define'
diff --git a/config_h.SH b/config_h.SH
index da0f2dbcd7b7..5a0f81cf2011 100755
--- a/config_h.SH
+++ b/config_h.SH
@@ -142,6 +142,12 @@ sed <<!GROK!THIS! >$CONFIG_H -e 's!^#undef\(.*/\)\*!/\*#define\1 \*!' -e 's!^#un
*/
#$d_fcntl HAS_FCNTL /**/
+/* HAS_FDOPENDIR:
+ * This symbol, if defined, indicates that the fdopen routine is
+ * available to open a directory descriptor.
+ */
+#$d_fdopendir HAS_FDOPENDIR /**/
+
/* HAS_FGETPOS:
* This symbol, if defined, indicates that the fgetpos routine is
* available to get the file position indicator, similar to ftell().
diff --git a/configure.com b/configure.com
index 99527c180bfc..7c38711bb85d 100644
--- a/configure.com
+++ b/configure.com
@@ -6010,6 +6010,7 @@ $ WC "d_fd_set='" + d_fd_set + "'"
$ WC "d_fd_macros='define'"
$ WC "d_fdclose='undef'"
$ WC "d_fdim='" + d_fdim + "'"
+$ WC "d_fdopendir='undef'"
$ WC "d_fds_bits='define'"
$ WC "d_fegetround='undef'"
$ WC "d_ffs='undef'"
diff --git a/plan9/config_sh.sample b/plan9/config_sh.sample
index 636acbdf6db3..246bad954424 100644
--- a/plan9/config_sh.sample
+++ b/plan9/config_sh.sample
@@ -212,6 +212,7 @@ d_fd_macros='undef'
d_fd_set='undef'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir=undef
d_fds_bits='undef'
d_fegetround='undef'
d_ffs='undef'
diff --git a/sv.c b/sv.c
index ae6d09dea28a..8a005b2d165b 100644
--- a/sv.c
+++ b/sv.c
@@ -14096,15 +14096,6 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
{
DIR *ret;
-#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
- DIR *pwd;
- const Direntry_t *dirent;
- char smallbuf[256]; /* XXX MAXPATHLEN, surely? */
- char *name = NULL;
- STRLEN len = 0;
- long pos;
-#endif
-
PERL_UNUSED_CONTEXT;
PERL_ARGS_ASSERT_DIRP_DUP;
@@ -14116,89 +14107,13 @@ Perl_dirp_dup(pTHX_ DIR *const dp, CLONE_PARAMS *const param)
if (ret)
return ret;
-#if defined(HAS_FCHDIR) && defined(HAS_TELLDIR) && defined(HAS_SEEKDIR)
+#ifdef HAS_FDOPENDIR
PERL_UNUSED_ARG(param);
- /* create anew */
-
- /* open the current directory (so we can switch back) */
- if (!(pwd = PerlDir_open("."))) return (DIR *)NULL;
-
- /* chdir to our dir handle and open the present working directory */
- if (fchdir(my_dirfd(dp)) < 0 || !(ret = PerlDir_open("."))) {
- PerlDir_close(pwd);
- return (DIR *)NULL;
- }
- /* Now we should have two dir handles pointing to the same dir. */
-
- /* Be nice to the calling code and chdir back to where we were. */
- /* XXX If this fails, then what? */
- PERL_UNUSED_RESULT(fchdir(my_dirfd(pwd)));
+ ret = fdopendir(dup(my_dirfd(dp)));
- /* We have no need of the pwd handle any more. */
- PerlDir_close(pwd);
-
-#ifdef DIRNAMLEN
-# define d_namlen(d) (d)->d_namlen
-#else
-# define d_namlen(d) strlen((d)->d_name)
-#endif
- /* Iterate once through dp, to get the file name at the current posi-
- tion. Then step back. */
- pos = PerlDir_tell(dp);
- if ((dirent = PerlDir_read(dp))) {
- len = d_namlen(dirent);
- if (len > sizeof(dirent->d_name) && sizeof(dirent->d_name) > PTRSIZE) {
- /* If the len is somehow magically longer than the
- * maximum length of the directory entry, even though
- * we could fit it in a buffer, we could not copy it
- * from the dirent. Bail out. */
- PerlDir_close(ret);
- return (DIR*)NULL;
- }
- if (len <= sizeof smallbuf) name = smallbuf;
- else Newx(name, len, char);
- Move(dirent->d_name, name, len, char);
- }
- PerlDir_seek(dp, pos);
-
- /* Iterate through the new dir handle, till we find a file with the
- right name. */
- if (!dirent) /* just before the end */
- for(;;) {
- pos = PerlDir_tell(ret);
- if (PerlDir_read(ret)) continue; /* not there yet */
- PerlDir_seek(ret, pos); /* step back */
- break;
- }
- else {
- const long pos0 = PerlDir_tell(ret);
- for(;;) {
- pos = PerlDir_tell(ret);
- if ((dirent = PerlDir_read(ret))) {
- if (len == (STRLEN)d_namlen(dirent)
- && memEQ(name, dirent->d_name, len)) {
- /* found it */
- PerlDir_seek(ret, pos); /* step back */
- break;
- }
- /* else we are not there yet; keep iterating */
- }
- else { /* This is not meant to happen. The best we can do is
- reset the iterator to the beginning. */
- PerlDir_seek(ret, pos0);
- break;
- }
- }
- }
-#undef d_namlen
-
- if (name && name != smallbuf)
- Safefree(name);
-#endif
-
-#ifdef WIN32
+#elif defined(WIN32)
ret = win32_dirp_dup(dp, param);
#endif
diff --git a/t/op/threads-dirh.t b/t/op/threads-dirh.t
index bb4bcfc14184..14c399ca19cd 100644
--- a/t/op/threads-dirh.t
+++ b/t/op/threads-dirh.t
@@ -13,16 +13,12 @@ BEGIN {
skip_all_if_miniperl("no dynamic loading on miniperl, no threads");
skip_all("runs out of memory on some EBCDIC") if $ENV{PERL_SKIP_BIG_MEM_TESTS};
- plan(6);
+ plan(1);
}
use strict;
use warnings;
use threads;
-use threads::shared;
-use File::Path;
-use File::Spec::Functions qw 'updir catdir';
-use Cwd 'getcwd';
# Basic sanity check: make sure this does not crash
fresh_perl_is <<'# this is no comment', 'ok', {}, 'crash when duping dirh';
@@ -31,101 +27,3 @@ fresh_perl_is <<'# this is no comment', 'ok', {}, 'crash when duping dirh';
async{}->join for 1..2;
print "ok";
# this is no comment
-
-my $dir;
-SKIP: {
- skip "telldir or seekdir not defined on this platform", 5
- if !$Config::Config{d_telldir} || !$Config::Config{d_seekdir};
- my $skip = sub {
- chdir($dir);
- chdir updir;
- skip $_[0], 5
- };
-
- if(!$Config::Config{d_fchdir} && $^O ne "MSWin32") {
- $::TODO = 'dir handle cloning currently requires fchdir on non-Windows platforms';
- }
-
- my @w :shared; # warnings accumulator
- local $SIG{__WARN__} = sub { push @w, $_[0] };
-
- $dir = catdir getcwd(), "thrext$$" . int rand() * 100000;
-
- rmtree($dir) if -d $dir;
- mkdir($dir);
-
- # Create a dir structure like this:
- # $dir
- # |
- # `- toberead
- # |
- # +---- thrit
- # |
- # +---- rile
- # |
- # `---- zor
-
- chdir($dir);
- mkdir 'toberead';
- chdir 'toberead';
- {open my $fh, ">thrit" or &$skip("Cannot create file thrit")}
- {open my $fh, ">rile" or &$skip("Cannot create file rile")}
- {open my $fh, ">zor" or &$skip("Cannot create file zor")}
- chdir updir;
-
- # Then test that dir iterators are cloned correctly.
-
- opendir my $toberead, 'toberead';
- my $start_pos = telldir $toberead;
- my @first_2 = (scalar readdir $toberead, scalar readdir $toberead);
- my @from_thread = @{; async { [readdir $toberead ] } ->join };
- my @from_main = readdir $toberead;
- is join('-', sort @from_thread), join('-', sort @from_main),
- 'dir iterator is copied from one thread to another';
- like
- join('-', "", sort(@first_2, @from_thread), ""),
- qr/(?<!-rile)-rile-thrit-zor-(?!zor-)/i,
- 'cloned iterator iterates exactly once over everything not already seen';
-
- seekdir $toberead, $start_pos;
- readdir $toberead for 1 .. @first_2+@from_thread;
- {
- local $::TODO; # This always passes when dir handles are not cloned.
- is
- async { readdir $toberead // 'undef' } ->join, 'undef',
- 'cloned dir iterator that points to the end of the directory'
- ;
- }
-
- # Make sure the cloning code can handle file names longer than 255 chars
- SKIP: {
- chdir 'toberead';
- open my $fh,
- ">floccipaucinihilopilification-"
- . "pneumonoultramicroscopicsilicovolcanoconiosis-"
- . "lopadotemachoselachogaleokranioleipsanodrimypotrimmatosilphiokarabo"
- . "melitokatakechymenokichlepikossyphophattoperisteralektryonoptokephal"
- . "liokinklopeleiolagoiosiraiobaphetraganopterygon"
- or
- chdir updir,
- skip("OS does not support long file names (and I mean *long*)", 1);
- chdir updir;
- opendir my $dirh, "toberead";
- my $test_name
- = "dir iterators can be cloned when the next fn > 255 chars";
- while() {
- my $pos = telldir $dirh;
- my $fn = readdir($dirh);
- if(!defined $fn) { fail($test_name); last SKIP; }
- if($fn =~ 'lagoio') {
- seekdir $dirh, $pos;
- last;
- }
- }
- is length async { scalar readdir $dirh } ->join, 258, $test_name;
- }
-
- is scalar @w, 0, 'no warnings during all that' or diag @w;
- chdir updir;
-}
-rmtree($dir);
diff --git a/win32/config.gc b/win32/config.gc
index f8776188c09c..34aa8de6ed75 100644
--- a/win32/config.gc
+++ b/win32/config.gc
@@ -199,6 +199,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir='undef'
d_fds_bits='define'
d_fegetround='undef'
d_ffs='undef'
diff --git a/win32/config.vc b/win32/config.vc
index 619979e22b53..536085fe94e0 100644
--- a/win32/config.vc
+++ b/win32/config.vc
@@ -199,6 +199,7 @@ d_fd_macros='define'
d_fd_set='define'
d_fdclose='undef'
d_fdim='undef'
+d_fdopendir='undef'
d_fds_bits='define'
d_fegetround='undef'
d_ffs='undef'
+1 -27
View File
@@ -7,36 +7,10 @@ ExtUtils::MakeMaker
JSON::PP
Data::Dumper
Updated for perl v5.38.0 by stig@stig.io
Updated for perl v5.40.0 by marcus@means.no
---
diff --git a/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm b/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm
index b0e83b0d2d..dab4907704 100644
--- a/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm
+++ b/cpan/CPAN-Meta-Requirements/lib/CPAN/Meta/Requirements.pm
@@ -86,21 +86,7 @@ sub new {
# from version::vpp
sub _find_magic_vstring {
my $value = shift;
- my $tvalue = '';
- require B;
- my $sv = B::svref_2object(\$value);
- my $magic = ref($sv) eq 'B::PVMG' ? $sv->MAGIC : undef;
- while ( $magic ) {
- if ( $magic->TYPE eq 'V' ) {
- $tvalue = $magic->PTR;
- $tvalue =~ s/^v?(.+)$/v$1/;
- last;
- }
- else {
- $magic = $magic->MOREMAGIC;
- }
- }
- return $tvalue;
+ return version::->parse($value)->stringify;
}
# safe if given an unblessed reference
diff --git a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
index 746abd63bc..c55d7cd2d0 100644
@@ -1,224 +0,0 @@
From: =?UTF-8?q?Christian=20K=C3=B6gler?= <ck3d@gmx.de>
Date: Mon, 10 Apr 2023 22:12:24 +0200
Subject: [PATCH] miniperl compatible modules
CPAN::Meta
ExtUtils::MakeMaker
JSON::PP
Data::Dumper
Updated for perl v5.40.0 by marcus@means.no
---
# safe if given an unblessed reference
diff --git a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
index 746abd63bc..c55d7cd2d0 100644
--- a/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
+++ b/cpan/CPAN-Meta-YAML/lib/CPAN/Meta/YAML.pm
@@ -1,6 +1,7 @@
use 5.008001; # sane UTF-8 support
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::YAML; # git description: v1.68-2-gcc5324e
# XXX-INGY is 5.8.1 too old/broken for utf8?
# XXX-XDG Lancaster consensus was that it was sufficient until
@@ -650,27 +651,29 @@ sub _dump_string {
join '', map { "$_\n" } @lines;
}
-sub _has_internal_string_value {
+# taken from cpan/JSON-PP/lib/JSON/PP.pm
+sub _looks_like_number {
my $value = shift;
- my $b_obj = B::svref_2object(\$value); # for round trip problem
- return $b_obj->FLAGS & B::SVf_POK();
+ no warnings 'numeric';
+ # if the utf8 flag is on, it almost certainly started as a string
+ return if utf8::is_utf8($value);
+ # detect numbers
+ # string & "" -> ""
+ # number & "" -> 0 (with warning)
+ # nan and inf can detect as numbers, so check with * 0
+ return unless length((my $dummy = "") & $value);
+ return unless 0 + $value eq $value;
+ return 1 if $value * 0 == 0;
+ return -1; # inf/nan
}
sub _dump_scalar {
my $string = $_[1];
my $is_key = $_[2];
- # Check this before checking length or it winds up looking like a string!
- my $has_string_flag = _has_internal_string_value($string);
return '~' unless defined $string;
return "''" unless length $string;
- if (Scalar::Util::looks_like_number($string)) {
- # keys and values that have been used as strings get quoted
- if ( $is_key || $has_string_flag ) {
- return qq['$string'];
- }
- else {
- return $string;
- }
+ if (_looks_like_number($string)) {
+ return qq['$string'];
}
if ( $string =~ /[\x00-\x09\x0b-\x0d\x0e-\x1f\x7f-\x9f\'\n]/ ) {
$string =~ s/\\/\\\\/g;
@@ -800,9 +803,6 @@ sub errstr {
# Helper functions. Possibly not needed.
-# Use to detect nv or iv
-use B;
-
# XXX-INGY Is flock CPAN::Meta::YAML's responsibility?
# Some platforms can't flock :-(
# XXX-XDG I think it is. When reading and writing files, we ought
@@ -822,35 +822,8 @@ sub _can_flock {
}
}
-
-# XXX-INGY Is this core in 5.8.1? Can we remove this?
-# XXX-XDG Scalar::Util 1.18 didn't land until 5.8.8, so we need this
-#####################################################################
-# Use Scalar::Util if possible, otherwise emulate it
-
-use Scalar::Util ();
BEGIN {
- local $@;
- if ( eval { Scalar::Util->VERSION(1.18); } ) {
- *refaddr = *Scalar::Util::refaddr;
- }
- else {
- eval <<'END_PERL';
-# Scalar::Util failed to load or too old
-sub refaddr {
- my $pkg = ref($_[0]) or return undef;
- if ( !! UNIVERSAL::can($_[0], 'can') ) {
- bless $_[0], 'Scalar::Util::Fake';
- } else {
- $pkg = undef;
- }
- "$_[0]" =~ /0x(\w+)/;
- my $i = do { no warnings 'portable'; hex $1 };
- bless $_[0], $pkg if defined $pkg;
- $i;
-}
-END_PERL
- }
+ *refaddr = *builtin::refaddr;
}
delete $CPAN::Meta::YAML::{refaddr};
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
index 3604eae402..991f69d275 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Merge.pm
@@ -1,12 +1,13 @@
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::Merge;
our $VERSION = '2.150010';
use Carp qw/croak/;
-use Scalar::Util qw/blessed/;
+use builtin qw/blessed/;
use CPAN::Meta::Converter 2.141170;
sub _is_identical {
diff --git a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
index d4e93fd8a5..809da68d02 100644
--- a/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
+++ b/cpan/CPAN-Meta/lib/CPAN/Meta/Prereqs.pm
@@ -1,6 +1,7 @@
use 5.006;
use strict;
use warnings;
+no warnings 'experimental::builtin';
package CPAN::Meta::Prereqs;
our $VERSION = '2.150010';
@@ -14,7 +15,6 @@ our $VERSION = '2.150010';
#pod =cut
use Carp qw(confess);
-use Scalar::Util qw(blessed);
use CPAN::Meta::Requirements 2.121;
#pod =method new
@@ -168,7 +168,12 @@ sub types_in {
sub with_merged_prereqs {
my ($self, $other) = @_;
- my @other = blessed($other) ? $other : @$other;
+ eval 'require Scalar::Util';
+ my @other = unless($@){
+ Scalar::Util::blessed($other) ? $other : @$other;
+ }else{
+ builtin::blessed($other) ? $other : @$other;
+ }
my @prereq_objs = ($self, @other);
diff --git a/cpan/JSON-PP/lib/JSON/PP.pm b/cpan/JSON-PP/lib/JSON/PP.pm
index fc8fcbc8f0..cda7b90c65 100644
--- a/cpan/JSON-PP/lib/JSON/PP.pm
+++ b/cpan/JSON-PP/lib/JSON/PP.pm
@@ -4,6 +4,7 @@ package JSON::PP;
use 5.008;
use strict;
+no warnings 'experimental::builtin';
use Exporter ();
BEGIN { our @ISA = ('Exporter') }
diff --git a/dist/Data-Dumper/Dumper.pm b/dist/Data-Dumper/Dumper.pm
index bb6d3caedb..0c2fde4743 100644
--- a/dist/Data-Dumper/Dumper.pm
+++ b/dist/Data-Dumper/Dumper.pm
@@ -11,6 +11,7 @@ package Data::Dumper;
use strict;
use warnings;
+no warnings 'experimental::builtin';
#$| = 1;
@@ -125,8 +126,7 @@ sub new {
# Packed numeric addresses take less memory. Plus pack is faster than sprintf
sub format_refaddr {
- require Scalar::Util;
- pack "J", Scalar::Util::refaddr(shift);
+ pack "J", builtin::refaddr(shift);
};
#
@@ -282,9 +282,8 @@ sub _dump {
warn "WARNING(Freezer method call failed): $@" if $@;
}
- require Scalar::Util;
- my $realpack = Scalar::Util::blessed($val);
- my $realtype = $realpack ? Scalar::Util::reftype($val) : ref $val;
+ my $realpack = builtin::blessed($val);
+ my $realtype = $realpack ? builtin::reftype($val) : ref $val;
$id = format_refaddr($val);
# Note: By this point $name is always defined and of non-zero length.
@@ -576,7 +575,7 @@ sub _dump {
# here generates a different result. So there are actually "three" different
# implementations of Data::Dumper (kind of sort of) but we only test two.
elsif (!defined &_vstring
- and ref $ref eq 'VSTRING' || eval{Scalar::Util::isvstring($val)}) {
+ and ref $ref eq 'VSTRING') {
$out .= sprintf "v%vd", $val;
}
# \d here would treat "1\x{660}" as a safe decimal number
+4 -13
View File
@@ -68,19 +68,10 @@ let
in
rec {
# Maint version
perl538 = callPackage ./interpreter.nix {
self = perl538;
version = "5.38.2";
sha256 = "sha256-oKMVNEUet7g8fWWUpJdUOlTUiLyQygD140diV39AZV4=";
inherit passthruFun;
};
# Maint version
perl540 = callPackage ./interpreter.nix {
self = perl540;
version = "5.40.0";
sha256 = "sha256-x0A0jzVzljJ6l5XT6DI7r9D+ilx4NfwcuroMyN/nFh8=";
perl5 = callPackage ./interpreter.nix {
self = perl5;
version = "5.42.0";
sha256 = "sha256-4JPvGE1/mhuXl+JGUpb1VRCtttq4hCsMPtUzKWYwltw=";
inherit passthruFun;
};
}
@@ -1,57 +0,0 @@
From bd0ab509f890a6638bd5033ef58526f8c74f7e4b Mon Sep 17 00:00:00 2001
From: Andrei Horodniceanu <a.horodniceanu@proton.me>
Date: Wed, 4 Sep 2024 12:46:44 +0300
Subject: [PATCH] locale.c: Fix compilation on platforms with only a C locale
Signed-off-by: Andrei Horodniceanu <a.horodniceanu@proton.me>
---
AUTHORS | 1 +
locale.c | 16 ++++++++++++++++
2 files changed, 17 insertions(+)
diff --git a/AUTHORS b/AUTHORS
index b2e0bf2043a9..b196b93bda13 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -103,6 +103,7 @@ Andreas König <a.koenig@mind.de>
Andreas Marienborg <andreas.marienborg@gmail.com>
Andreas Schwab <schwab@suse.de>
Andreas Voegele <andreas@andreasvoegele.com>
+Andrei Horodniceanu <a.horodniceanu@proton.me>
Andrei Yelistratov <andrew@sundale.net>
Andrej Borsenkow <Andrej.Borsenkow@mow.siemens.ru>
Andrew Bettison <andrewb@zip.com.au>
diff --git a/locale.c b/locale.c
index 168b94914318..d764b4b3c11e 100644
--- a/locale.c
+++ b/locale.c
@@ -8963,6 +8963,7 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
* categories into our internal indices. */
if (map_LC_ALL_position_to_index[0] == LC_ALL_INDEX_) {
+# ifdef PERL_LC_ALL_CATEGORY_POSITIONS_INIT
/* Use this array, initialized by a config.h constant */
int lc_all_category_positions[] = PERL_LC_ALL_CATEGORY_POSITIONS_INIT;
STATIC_ASSERT_STMT( C_ARRAY_LENGTH(lc_all_category_positions)
@@ -8975,6 +8976,21 @@ Perl_init_i18nl10n(pTHX_ int printwarn)
map_LC_ALL_position_to_index[i] =
get_category_index(lc_all_category_positions[i]);
}
+# else
+ /* It is possible for both PERL_LC_ALL_USES_NAME_VALUE_PAIRS and
+ * PERL_LC_ALL_CATEGORY_POSITIONS_INIT not to be defined, e.g. on
+ * systems with only a C locale during ./Configure. Assume that this
+ * can only happen as part of some sort of bootstrapping so allow
+ * compilation to succeed by ignoring correctness.
+ */
+ for (unsigned int i = 0;
+ i < C_ARRAY_LENGTH(map_LC_ALL_position_to_index);
+ i++)
+ {
+ map_LC_ALL_position_to_index[i] = 0;
+ }
+# endif
+
}
LOCALE_UNLOCK;
@@ -15,7 +15,7 @@
zlib,
config,
passthruFun,
perlAttr ? "perl${lib.versions.major version}${lib.versions.minor version}",
perlAttr ? "perl${lib.versions.major version}",
enableThreading ? true,
coreutils,
makeWrapper,
@@ -71,27 +71,16 @@ stdenv.mkDerivation (
disallowedReferences = [ stdenv.cc ];
patches = [
./CVE-2024-56406.patch
./CVE-2025-40909.patch
]
# Do not look in /usr etc. for dependencies.
++ lib.optional ((lib.versions.majorMinor version) == "5.38") ./no-sys-dirs-5.38.0.patch
++ lib.optional ((lib.versions.majorMinor version) == "5.40") ./no-sys-dirs-5.40.0.patch
# Fix compilation on platforms with only a C locale: https://github.com/Perl/perl5/pull/22569
++ lib.optional (version == "5.40.0") ./fix-build-with-only-C-locale-5.40.0.patch
++ lib.optional stdenv.hostPlatform.isSunOS ./ld-shared.patch
++ lib.optionals stdenv.hostPlatform.isDarwin [
./cpp-precomp.patch
./sw_vers.patch
]
# fixes build failure due to missing d_fdopendir/HAS_FDOPENDIR configure option
# https://github.com/arsv/perl-cross/pull/159
++ lib.optional (crossCompiling && (lib.versionAtLeast version "5.40.0")) ./cross-fdopendir.patch
++ lib.optional (crossCompiling && (lib.versionAtLeast version "5.40.0")) ./cross540.patch
++ lib.optional (crossCompiling && (lib.versionOlder version "5.40.0")) ./cross.patch;
patches =
[
./no-sys-dirs.patch
]
++ lib.optional stdenv.hostPlatform.isSunOS ./ld-shared.patch
++ lib.optionals stdenv.hostPlatform.isDarwin [
./cpp-precomp.patch
./sw_vers.patch
]
++ lib.optional crossCompiling ./cross.patch;
# This is not done for native builds because pwd may need to come from
# bootstrap tools when building bootstrap perl.
@@ -186,7 +175,7 @@ stdenv.mkDerivation (
dontAddPrefix = !crossCompiling;
enableParallelBuilding = false;
enableParallelBuilding = true;
# perl includes the build date, the uname of the build system and the
# username of the build user in some files.
@@ -1,256 +0,0 @@
diff --git a/Configure b/Configure
index e261cb9548..3bbbc4b9df 100755
--- a/Configure
+++ b/Configure
@@ -108,15 +108,7 @@ if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' 2>&1 ) 2>&1 >/dev/null ; th
fi
: Proper PATH setting
-paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
-paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
-paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
-paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
-paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
-paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
-paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
-paths="$paths /sbin /usr/sbin /usr/libexec"
-paths="$paths /system/gnu_library/bin"
+paths=''
for p in $paths
do
@@ -1455,8 +1447,7 @@ groupstype=''
i_whoami=''
: Possible local include directories to search.
: Set locincpth to "" in a hint file to defeat local include searches.
-locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
-locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
+locincpth=""
:
: no include file wanted by default
inclwanted=''
@@ -1470,17 +1461,12 @@ DEBUGGING=''
archobjs=''
libnames=''
: change the next line if compiling for Xenix/286 on Xenix/386
-xlibpth='/usr/lib/386 /lib/386'
+xlibpth=''
: Possible local library directories to search.
-loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
-loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
+loclibpth=""
: general looking path for locating libraries
-glibpth="/lib /usr/lib $xlibpth"
-glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
-test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
-test -f /shlib/libc.so && glibpth="/shlib $glibpth"
-test -d /usr/lib64 && glibpth="$glibpth /lib64 /usr/lib64 /usr/local/lib64"
+glibpth=""
: Private path used by Configure to find libraries. Its value
: is prepended to libpth. This variable takes care of special
@@ -1515,8 +1501,6 @@ libswanted="cl pthread socket bind inet ndbm gdbm dbm db malloc dl ld"
libswanted="$libswanted sun m crypt sec util c cposix posix ucb bsd BSD"
: We probably want to search /usr/shlib before most other libraries.
: This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
-glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
-glibpth="/usr/shlib $glibpth"
: Do not use vfork unless overridden by a hint file.
usevfork=false
@@ -2581,7 +2565,6 @@ uname
zip
"
pth=`echo $PATH | sed -e "s/$p_/ /g"`
-pth="$pth $sysroot/lib $sysroot/usr/lib"
for file in $loclist; do
eval xxx=\$$file
case "$xxx" in
@@ -5023,7 +5006,7 @@ esac
: Set private lib path
case "$plibpth" in
'') if ./mips; then
- plibpth="$incpath/usr/lib $sysroot/usr/local/lib $sysroot/usr/ccs/lib"
+ plibpth="$incpath/usr/lib"
fi;;
esac
case "$libpth" in
@@ -8860,13 +8843,8 @@ esac
echo " "
case "$sysman" in
'')
- syspath='/usr/share/man/man1 /usr/man/man1'
- syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
- syspath="$syspath /usr/man/u_man/man1"
- syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
- syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
- syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
- sysman=`./loc . /usr/man/man1 $syspath`
+ syspath=''
+ sysman=''
;;
esac
if $test -d "$sysman"; then
@@ -21500,9 +21478,10 @@ $rm_try tryp
case "$full_ar" in
'') full_ar=$ar ;;
esac
+full_ar=ar
: Store the full pathname to the sed program for use in the C program
-full_sed=$sed
+full_sed=sed
: see what type gids are declared as in the kernel
echo " "
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index ae647d5f06..9a05d66592 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -135,12 +135,7 @@ sub get_files {
if ($dep =~ /(\S+errno\.h)/) {
push(@file, $1);
}
- } elsif ($^O eq 'linux' &&
- $Config{gccversion} ne '' &&
- $Config{gccversion} !~ /intel/i &&
- # might be using, say, Intel's icc
- $linux_errno_h
- ) {
+ } elsif (0) {
push(@file, $linux_errno_h);
} elsif ($^O eq 'haiku') {
# hidden in a special place
diff --git a/hints/freebsd.sh b/hints/freebsd.sh
index 4d26835e99..c6d365d84d 100644
--- a/hints/freebsd.sh
+++ b/hints/freebsd.sh
@@ -127,21 +127,21 @@ case "$osvers" in
objformat=`/usr/bin/objformat`
if [ x$objformat = xaout ]; then
if [ -e /usr/lib/aout ]; then
- libpth="/usr/lib/aout /usr/local/lib /usr/lib"
- glibpth="/usr/lib/aout /usr/local/lib /usr/lib"
+ libpth=""
+ glibpth=""
fi
lddlflags='-Bshareable'
else
- libpth="/usr/lib /usr/local/lib"
- glibpth="/usr/lib /usr/local/lib"
+ libpth=""
+ glibpth=""
ldflags="-Wl,-E "
lddlflags="-shared "
fi
cccdlflags='-DPIC -fPIC'
;;
*)
- libpth="/usr/lib /usr/local/lib"
- glibpth="/usr/lib /usr/local/lib"
+ libpth=""
+ glibpth=""
ldflags="-Wl,-E "
lddlflags="-shared "
cccdlflags='-DPIC -fPIC'
diff --git a/hints/linux.sh b/hints/linux.sh
index e1508c7509..5a187c583a 100644
--- a/hints/linux.sh
+++ b/hints/linux.sh
@@ -150,28 +150,6 @@ case "$optimize" in
;;
esac
-# Ubuntu 11.04 (and later, presumably) doesn't keep most libraries
-# (such as -lm) in /lib or /usr/lib. So we have to ask gcc to tell us
-# where to look. We don't want gcc's own libraries, however, so we
-# filter those out.
-# This could be conditional on Ubuntu, but other distributions may
-# follow suit, and this scheme seems to work even on rather old gcc's.
-# This unconditionally uses gcc because even if the user is using another
-# compiler, we still need to find the math library and friends, and I don't
-# know how other compilers will cope with that situation.
-# Morever, if the user has their own gcc earlier in $PATH than the system gcc,
-# we don't want its libraries. So we try to prefer the system gcc
-# Still, as an escape hatch, allow Configure command line overrides to
-# plibpth to bypass this check.
-if [ -x /usr/bin/gcc ] ; then
- gcc=/usr/bin/gcc
-# clang also provides -print-search-dirs
-elif ${cc:-cc} --version 2>/dev/null | grep -q '^clang ' ; then
- gcc=${cc:-cc}
-else
- gcc=gcc
-fi
-
case "$plibpth" in
'') plibpth=`LANG=C LC_ALL=C $gcc $ccflags $ldflags -print-search-dirs | grep libraries |
cut -f2- -d= | tr ':' $trnl | grep -v 'gcc' | sed -e 's:/$::'`
@@ -208,32 +186,6 @@ case "$usequadmath" in
;;
esac
-case "$libc" in
-'')
-# If you have glibc, then report the version for ./myconfig bug reporting.
-# (Configure doesn't need to know the specific version since it just uses
-# gcc to load the library for all tests.)
-# We don't use __GLIBC__ and __GLIBC_MINOR__ because they
-# are insufficiently precise to distinguish things like
-# libc-2.0.6 and libc-2.0.7.
- for p in $plibpth
- do
- for trylib in libc.so.6 libc.so
- do
- if $test -e $p/$trylib; then
- libc=`ls -l $p/$trylib | awk '{print $NF}'`
- if $test "X$libc" != X; then
- break
- fi
- fi
- done
- if $test "X$libc" != X; then
- break
- fi
- done
- ;;
-esac
-
if ${sh:-/bin/sh} -c exit; then
echo ''
echo 'You appear to have a working bash. Good.'
@@ -311,33 +263,6 @@ sparc*)
;;
esac
-# SuSE8.2 has /usr/lib/libndbm* which are ld scripts rather than
-# true libraries. The scripts cause binding against static
-# version of -lgdbm which is a bad idea. So if we have 'nm'
-# make sure it can read the file
-# NI-S 2003/08/07
-case "$nm" in
- '') ;;
- *)
- for p in $plibpth
- do
- if $test -r $p/libndbm.so; then
- if $nm $p/libndbm.so >/dev/null 2>&1 ; then
- echo 'Your shared -lndbm seems to be a real library.'
- _libndbm_real=1
- break
- fi
- fi
- done
- if $test "X$_libndbm_real" = X; then
- echo 'Your shared -lndbm is not a real library.'
- set `echo X "$libswanted "| sed -e 's/ ndbm / /'`
- shift
- libswanted="$*"
- fi
- ;;
-esac
-
# Linux on Synology.
if [ -f /etc/synoinfo.conf -a -d /usr/syno ]; then
# Tested on Synology DS213 and DS413
+4 -10
View File
@@ -327,11 +327,6 @@ with pkgs;
stdenv = clangStdenv;
};
cope = callPackage ../by-name/co/cope/package.nix {
perl = perl538;
perlPackages = perl538Packages;
};
coolercontrol = recurseIntoAttrs (callPackage ../applications/system/coolercontrol { });
cup-docker-noserver = cup-docker.override { withServer = false; };
@@ -8928,13 +8923,12 @@ with pkgs;
### DEVELOPMENT / PERL MODULES
perlInterpreters = import ../development/interpreters/perl { inherit callPackage; };
inherit (perlInterpreters) perl538 perl540;
inherit (perlInterpreters) perl5;
perl538Packages = recurseIntoAttrs perl538.pkgs;
perl540Packages = recurseIntoAttrs perl540.pkgs;
perl5Packages = recurseIntoAttrs perl5.pkgs;
perl = perl540;
perlPackages = perl540Packages;
perl = perl5;
perlPackages = perl5Packages;
ack = perlPackages.ack;