[perl/f16] Clear $@ before `do' I/O error

Petr Pisar ppisar at fedoraproject.org
Tue Sep 11 16:39:57 UTC 2012


commit 76fe32b6577a59176c683e99313ae241aeb4c6c9
Author: Petr Písař <ppisar at redhat.com>
Date:   Tue Sep 11 10:32:13 2012 +0200

    Clear $@ before `do' I/O error

 ...T-113730-should-be-cleared-on-do-IO-error.patch |   52 ++++++++++++++++++++
 perl.spec                                          |   10 +++-
 2 files changed, 61 insertions(+), 1 deletions(-)
---
diff --git a/perl-5.14.2-RT-113730-should-be-cleared-on-do-IO-error.patch b/perl-5.14.2-RT-113730-should-be-cleared-on-do-IO-error.patch
new file mode 100644
index 0000000..032a5ea
--- /dev/null
+++ b/perl-5.14.2-RT-113730-should-be-cleared-on-do-IO-error.patch
@@ -0,0 +1,52 @@
+From c972fa9ce0ad91f72c8f5650ce1e3aae4a3b571a Mon Sep 17 00:00:00 2001
+From: Eric Brine <ikegami at adaelis.com>
+Date: Mon, 18 Jun 2012 14:56:32 -0400
+Subject: [PATCH] RT#113730 - $@ should be cleared on "do" IO error.
+
+Petr Pisar: Ported to 5.14.2:
+
+From a3ff80c12c16886edf9acdd3d172798e50defdb3 Mon Sep 17 00:00:00 2001
+From: Eric Brine <ikegami at adaelis.com>
+Date: Mon, 18 Jun 2012 14:56:32 -0400
+Subject: [PATCH] RT#113730 - $@ should be cleared on "do" IO error.
+---
+ pp_ctl.c  |  1 +
+ t/op/do.t | 12 ++++++++++++
+ 2 files changed, 13 insertions(+)
+
+diff --git a/pp_ctl.c b/pp_ctl.c
+index 60bc30d..3f2e6f5 100644
+--- a/pp_ctl.c
++++ b/pp_ctl.c
+@@ -3842,6 +3842,7 @@ PP(pp_require)
+ 	    DIE(aTHX_ "Can't locate %s", name);
+ 	}
+ 
++	CLEAR_ERRSV();
+ 	RETPUSHUNDEF;
+     }
+     else
+diff --git a/t/op/do.t b/t/op/do.t
+index 787d632..4c9f0ef 100644
+--- a/t/op/do.t
++++ b/t/op/do.t
+@@ -197,4 +197,16 @@ is($x, 4, 'if (0){} else { ...; @a } receives caller scalar context');
+ @x = sub { if (0){} else { 0; @a } }->();
+ is("@x", "24 25 26 27", 'if (0){} else { ...; @a } receives caller list context');
+ 
++# RT#113730 - $@ should be cleared on IO error.
++{
++    $@ = "should not see";
++    $! = 0;
++    my $rv = do("some nonexistent file");
++    my $saved_error = $@;
++    my $saved_errno = $!;
++    ok(!$rv,          "do returns false on io errror");
++    ok(!$saved_error, "\$\@ not set on io error");
++    ok($saved_errno,  "\$! set on io error");
++}
++
+ done_testing();
+-- 
+1.7.11.4
+
diff --git a/perl.spec b/perl.spec
index c1bcf07..c4ab6c2 100644
--- a/perl.spec
+++ b/perl.spec
@@ -22,7 +22,7 @@
 Name:           perl
 Version:        %{perl_version}
 # release number must be even higher, because dual-lived modules will be broken otherwise
-Release:        199%{?dist}
+Release:        200%{?dist}
 Epoch:          %{perl_epoch}
 Summary:        Practical Extraction and Report Language
 Group:          Development/Languages
@@ -96,6 +96,9 @@ Patch15:        perl-5.14.2-Stop-V-from-leaking.patch
 # Fix find2perl to translate ? glob properly, rhbz#825701, RT#113054
 Patch16:        perl-5.14.2-find2perl-transtate-question-mark-properly.patch
 
+# Clear $@ before `do' I/O error, rhbz#834226, RT#113730
+Patch17:        perl-5.14.2-RT-113730-should-be-cleared-on-do-IO-error.patch
+
 # Update some of the bundled modules
 # see http://fedoraproject.org/wiki/Perl/perl.spec for instructions
 
@@ -1144,6 +1147,7 @@ tarball from perl.org.
 %patch14 -p1
 %patch15 -p1
 %patch16 -p1
+%patch17 -p1
 
 #copy the example script
 cp -a %{SOURCE5} .
@@ -1341,6 +1345,7 @@ pushd %{build_archlib}/CORE/
     'Fedora Patch14: Run signal handlers before returning from sigsuspend' \
     'Fedora Patch15: Stop !$^V from leaking' \
     'Fedora Patch16: Fix find2perl to translate ? glob properly (RT#113054)' \
+    'Fedora Patch17: Clear $@ before "do" I/O error (RT#113730)' \
     %{nil}
 
 rm patchlevel.bak
@@ -2230,6 +2235,9 @@ sed \
 
 # Old changelog entries are preserved in CVS.
 %changelog
+* Tue Sep 11 2012 Petr Pisar <ppisar at redhat.com> - 4:5.14.2-200
+- Clear $@ before `do' I/O error (bug #834226)
+
 * Wed Sep 05 2012 Petr Pisar <ppisar at redhat.com> - 4:5.14.2-199
 - Remove perl-devel dependency from perl-Test-Harness and perl-Test-Simple
 - Move App::Cpan from perl-Test-Harness to perl-CPAN (bug #854577)


More information about the scm-commits mailing list