Clear $@ before `do' I/O error

This commit is contained in:
Petr Písař 2012-09-11 10:32:13 +02:00
parent 01108a6d35
commit d7a74399bf
2 changed files with 51 additions and 0 deletions

View File

@ -0,0 +1,46 @@
From a3ff80c12c16886edf9acdd3d172798e50defdb3 Mon Sep 17 00:00:00 2001
From: Eric Brine <ikegami@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 b414e81..437bc8f 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -3928,6 +3928,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 93d3f73..c5a5905 100644
--- a/t/op/do.t
+++ b/t/op/do.t
@@ -286,4 +286,16 @@ SKIP: {
is($w, undef, 'do STRING does not propagate warning hints');
}
+# 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

View File

@ -93,6 +93,8 @@ Patch12: perl-5.16.1-PATCH-perl-114220-h-not-equiv-to-h.patch
# TODO Looks like it was fixed differently?
#Patch13: perl-5.14.2-locale-search-inc.patch
# Clear $@ before `do' I/O error, rhbz#834226, RT#113730
Patch13: perl-5.16.1-RT-113730-should-be-cleared-on-do-IO-error.patch
# Update some of the bundled modules
@ -1327,6 +1329,7 @@ tarball from perl.org.
%patch10 -p1
%patch11 -p1
%patch12 -p1
%patch13 -p1
#copy the example script
cp -a %{SOURCE5} .
@ -1531,6 +1534,7 @@ pushd %{build_archlib}/CORE/
'Fedora Patch10: Fix broken atof (RT#109318)' \
'Fedora Patch11: Do not access freed memory when cloning thread (RT#111610)' \
'Fedora Patch12: Match non-breakable space with /[\h]/ in ASCII mode (RT#114220)' \
'Fedora Patch13: Clear $@ before "do" I/O error (RT#113730)' \
%{nil}
rm patchlevel.bak
@ -2645,6 +2649,7 @@ sed \
* Tue Sep 11 2012 Petr Pisar <ppisar@redhat.com> - 4:5.16.1-233
- Do not access freed memory when cloning thread (bug #825749)
- Match non-breakable space with /[\h]/ in ASCII mode (bug #844919)
- Clear $@ before `do' I/O error (bug #834226)
* Wed Sep 05 2012 Petr Pisar <ppisar@redhat.com> - 4:5.16.1-232
- Move App::Cpan from perl-Test-Harness to perl-CPAN (bug #854577)