Fix fetching a magic on the stacked file tests

This commit is contained in:
Petr Písař 2020-11-12 15:18:17 +01:00
parent a17c914e59
commit 3fab80b10b
2 changed files with 64 additions and 0 deletions

View File

@ -0,0 +1,57 @@
From f877e124a20d4f94c82c36e6b7a99b4e9663e204 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Tue, 10 Nov 2020 15:50:27 +1100
Subject: [PATCH] fetch magic on the first stacked filetest, not the last
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
fixes #18293
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
pp_sys.c | 2 +-
t/op/filetest.t | 10 +++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/pp_sys.c b/pp_sys.c
index 66c5d9aade..5c9f768eaf 100644
--- a/pp_sys.c
+++ b/pp_sys.c
@@ -3067,7 +3067,7 @@ S_try_amagic_ftest(pTHX_ char chr) {
SV *const arg = *PL_stack_sp;
assert(chr != '?');
- if (!(PL_op->op_private & OPpFT_STACKING)) SvGETMAGIC(arg);
+ if (!(PL_op->op_private & OPpFT_STACKED)) SvGETMAGIC(arg);
if (SvAMAGIC(arg))
{
diff --git a/t/op/filetest.t b/t/op/filetest.t
index fe9724c59a..7c471c050c 100644
--- a/t/op/filetest.t
+++ b/t/op/filetest.t
@@ -9,7 +9,7 @@ BEGIN {
set_up_inc(qw '../lib ../cpan/Perl-OSType/lib');
}
-plan(tests => 57 + 27*14);
+plan(tests => 58 + 27*14);
if ($^O =~ /MSWin32|cygwin|msys/ && !is_miniperl) {
require Win32; # for IsAdminUser()
@@ -385,3 +385,11 @@ SKIP: {
ok(!-f "TEST\0-", '-f on name with \0');
ok(!-r "TEST\0-", '-r on name with \0');
}
+
+{
+ # github #18293
+ "" =~ /(.*)/;
+ my $x = $1; # call magic on $1, setting the pv to ""
+ "test.pl" =~ /(.*)/;
+ ok(-f -r $1, "stacked handles on a name with magic");
+}
--
2.25.4

View File

@ -262,6 +262,10 @@ Patch41: perl-5.33.3-Perl_custom_op_get_field-remove-undef-behaviour.patc
# Fix Config variable names in in t/op tests, in upstream after 5.33.3
Patch42: perl-5.33.3-t-op-inc.t-t-op-hexfp.t-t-op-sprintf2.t-Add-missing-.patch
# Fix fetching a magic on the stacked file test operators,
# in upstream after 5.33.3
Patch43: perl-5.33.3-fetch-magic-on-the-first-stacked-filetest-not-the-la.patch
# Link XS modules to libperl.so with EU::CBuilder on Linux, bug #960048
Patch200: perl-5.16.3-Link-XS-modules-to-libperl.so-with-EU-CBuilder-on-Li.patch
@ -4306,6 +4310,7 @@ you're not running VMS, this module does nothing.
%patch40 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch200 -p1
%patch201 -p1
@ -4355,6 +4360,7 @@ perl -x patchlevel.h \
'Fedora Patch40: Fix a code flow in Perl_sv_inc_nomg()' \
'Fedora Patch41: Fix un undefined behavior in Perl_custom_op_get_field()' \
'Fedora Patch42: Fix Config variable names in in t/op tests' \
'Fedora Patch43: Fix fetching a magic on the stacked file test operators' \
'Fedora Patch200: Link XS modules to libperl.so with EU::CBuilder on Linux' \
'Fedora Patch201: Link XS modules to libperl.so with EU::MM on Linux' \
%{nil}
@ -7076,6 +7082,7 @@ popd
* Thu Nov 12 2020 Petr Pisar <ppisar@redhat.com> - 4:5.32.0-466
- Fix un undefined behavior in Perl_custom_op_get_field()
- Fix Config variable names in in t/op tests
- Fix fetching a magic on the stacked file test operators
* Wed Oct 14 2020 Petr Pisar <ppisar@redhat.com> - 4:5.32.0-465
- Fix sv_collxfrm macro to respect locale