Fix a warning about an uninitialized value in B::Deparse

This commit is contained in:
Petr Písař 2020-03-27 16:54:07 +01:00
parent 5950f9b5f4
commit 844a55f096
2 changed files with 72 additions and 0 deletions

View File

@ -0,0 +1,66 @@
From fbe6adf2e4213395a34c891a7568c6e3c7812645 Mon Sep 17 00:00:00 2001
From: Yves Orton <demerphq@gmail.com>
Date: Thu, 6 Feb 2020 07:11:20 +0100
Subject: [PATCH] B::Deparse fixup uninitialized error in deparsing weird glob
statement
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This fixes issue #17537, and adds tests
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
lib/B/Deparse.pm | 2 +-
lib/B/Deparse.t | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/lib/B/Deparse.pm b/lib/B/Deparse.pm
index ee126b1552..aa6e6de4e4 100644
--- a/lib/B/Deparse.pm
+++ b/lib/B/Deparse.pm
@@ -3393,7 +3393,7 @@ sub pp_glob {
my $kid = $op->first->sibling; # skip pushmark
my $keyword =
$op->flags & OPf_SPECIAL ? 'glob' : $self->keyword('glob');
- my $text = $self->deparse($kid);
+ my $text = $self->deparse($kid, $cx);
return $cx >= 5 || $self->{'parens'}
? "$keyword($text)"
: "$keyword $text";
diff --git a/lib/B/Deparse.t b/lib/B/Deparse.t
index 07c915067e..e06ef6e966 100644
--- a/lib/B/Deparse.t
+++ b/lib/B/Deparse.t
@@ -20,6 +20,8 @@ my $deparse = B::Deparse->new();
isa_ok($deparse, 'B::Deparse', 'instantiate a B::Deparse object');
my %deparse;
+sub dummy_sub {42}
+
$/ = "\n####\n";
while (<DATA>) {
chomp;
@@ -679,6 +681,19 @@ readline $foo;
glob $foo;
glob $foo;
####
+# more <>
+no warnings;
+no strict;
+my $fh;
+if (dummy_sub < $fh > /bar/g) { 1 }
+>>>>
+no warnings;
+no strict;
+my $fh;
+if (dummy_sub(glob((' ' . $fh . ' ')) / 'bar' / 'g')) {
+ 1;
+}
+####
# readline
readline 'FH';
readline *$_;
--
2.21.1

View File

@ -326,6 +326,9 @@ Patch81: perl-5.31.8-pp_sort.c-fix-fencepost-error-in-call-to-av_extend.p
# in upstream after 5.31.8
Patch82: perl-5.30.2-toke.c-fix-Multidimensional-array-heuristic-to-ignor.patch
# Fix a warning about an uninitialized value in B::Deparse, GH#17537
Patch83: perl-5.31.9-B-Deparse-fixup-uninitialized-error-in-deparsing-wei.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
@ -4394,6 +4397,7 @@ you're not running VMS, this module does nothing.
%patch80 -p1
%patch81 -p1
%patch82 -p1
%patch83 -p1
%patch200 -p1
%patch201 -p1
@ -4469,6 +4473,7 @@ perl -x patchlevel.h \
'Fedora Patch80: Fix sorting tied arrays (GH#17496)' \
'Fedora Patch81: Fix sorting tied arrays (GH#17496)' \
'Fedora Patch82: Fix a spurious warning about a multidimensional syntax (GH#16535)' \
'Fedora Patch83: Fix a warning about an uninitialized value in B::Deparse (GH#17537)' \
'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}
@ -7233,6 +7238,7 @@ popd
- Fix sorting tied arrays (GH#17496)
- Fix a spurious warning about a multidimensional syntax (GH#16535)
- Normalize "#!/perl" shebangs in the tests
- Fix a warning about an uninitialized value in B::Deparse (GH#17537)
* Mon Mar 16 2020 Jitka Plesnikova <jplesnik@redhat.com> - 4:5.30.2-452
- 5.30.2 bump (see <https://metacpan.org/pod/release/SHAY/perl-5.30.2/pod/perldelta.pod>