There were 3 ideas for a patch: mine, Slaven's, and Father
Chrysostomos'. I tried out all 3, and all three appear to work, without
breaking #123171. But I chose FC's as I think it is the best.
I had to create a new .t because it turns out that the test didn't fail
when placed in the obvious test file, wrappers.t. It appears that the
'use File::Temp' in that file perturbs things to not fail later on.
This is scary, so I created a minimal file. I thought about using
fresh_perl, but wrappers.t needs functions from Test::More.
ext/POSIX/t/posix.t See if POSIX works
ext/POSIX/t/sigaction.t See if POSIX::sigaction works
ext/POSIX/t/sigset.t See if POSIX::SigSet works
+ext/POSIX/t/strerror_errno.t See if POSIX:strerror doesn't trash $!
ext/POSIX/t/sysconf.t See if POSIX works
ext/POSIX/t/taint.t See if POSIX works with taint
ext/POSIX/t/termios.t See if POSIX works
exit => 'status => CORE::exit($_[0])',
getenv => 'name => $ENV{$_[0]}',
system => 'command => CORE::system($_[0])',
- strerror => 'errno => use locale; local $! = $_[0]; "$!"',
+ strerror => 'errno => BEGIN { local $!; require locale; locale->import} local $! = $_[0]; "$!"',
strstr => 'big, little => CORE::index($_[0], $_[1])',
chmod => 'mode, filename => CORE::chmod($_[0], $_[1])',
fstat => 'fd => CORE::open my $dup, "<&", $_[0]; CORE::stat($dup)', # Gross.
--- /dev/null
+use Config;
+use Test::More;
+
+# This is placed in a separate file, as some 'requires' and 'uses' are known
+# to cause it to not fail even with the bug it's testing still being
+# broken. [perl #123503].
+
+plan(skip_all => "POSIX is unavailable")
+ unless $Config{extensions} =~ /\bPOSIX\b/;
+
+require POSIX;
+
+$! = 1;
+POSIX::strerror(1);
+is (0+$!, 1, 'strerror doesn\'t destroy $!');
+
+done_testing();