Report inaccesible file on failed require

This commit is contained in:
Petr Písař 2014-12-01 16:09:44 +01:00
parent 46308c06eb
commit aa05a418d0
2 changed files with 54 additions and 1 deletions

View File

@ -0,0 +1,44 @@
From e2ce0950e5e4b86c6fcbc488c37dd61d082b3e0d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Fri, 21 Nov 2014 10:48:51 +0100
Subject: [PATCH] Report inaccesible file on failed require
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Commit 2433d39e6 (require should die if a file exists but can't be
read) made first failed opened file fatal as request in
[perl #113422]. However error message produced in that case is not
much helpful in identifying which file ound not been accessed:
$ LANG=C perl -I/root -e 'require strict'
Can't locate strict.pm: Permission denied at -e line 1.
This patch adds the name of the failed file to the message to help
identify which @INC directory is erroneous:
$ LANG=C ./perl -I/root -I./lib -e 'require strict'
Can't locate strict.pm: /root/strict.pm: Permission denied at -e line 1.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
pp_ctl.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/pp_ctl.c b/pp_ctl.c
index 4b16e14..4f1c480 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4048,7 +4048,8 @@ PP(pp_require)
if (PL_op->op_type == OP_REQUIRE) {
if(saved_errno == EMFILE || saved_errno == EACCES) {
/* diag_listed_as: Can't locate %s */
- DIE(aTHX_ "Can't locate %s: %s", name, Strerror(saved_errno));
+ DIE(aTHX_ "Can't locate %s: %s: %s",
+ name, tryname, Strerror(saved_errno));
} else {
if (namesv) { /* did we lookup @INC? */
AV * const ar = GvAVn(PL_incgv);
--
1.9.3

View File

@ -30,7 +30,7 @@
Name: perl
Version: %{perl_version}
# release number must be even higher, because dual-lived modules will be broken otherwise
Release: 314%{?dist}
Release: 315%{?dist}
Epoch: %{perl_epoch}
Summary: Practical Extraction and Report Language
Group: Development/Languages
@ -93,6 +93,10 @@ Patch25: perl-5.18.2-t-op-crypt.t-Perform-SHA-256-algorithm-if-default-on
# Make *DBM_File desctructors thread-safe, bug #1107543, RT#61912
Patch26: perl-5.18.2-Destroy-GDBM-NDBM-ODBM-SDBM-_File-objects-only-from-.patch
# Report inaccesible file on failed require, bug #1166504, RT#123270,
# in upstream after 5.21.6
Patch27: perl-5.21.6-Report-inaccesible-file-on-failed-require.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
@ -1972,6 +1976,7 @@ tarball from perl.org.
%patch22 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch200 -p1
%patch201 -p1
@ -1991,6 +1996,7 @@ perl -x patchlevel.h \
'Fedora Patch22: Document Math::BigInt::CalcEmu requires Math::BigInt (CPAN RT#85015)' \
'Fedora Patch25: Use stronger algorithm needed for FIPS in t/op/crypt.t (RT#121591)' \
'Fedora Patch26: Make *DBM_File desctructors thread-safe (RT#61912)' \
'Fedora Patch27: Report inaccesible file on failed require (RT#123270)' \
'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}
@ -3781,6 +3787,9 @@ sed \
# Old changelog entries are preserved in CVS.
%changelog
* Mon Dec 01 2014 Petr Pisar <ppisar@redhat.com> - 4:5.20.1-315
- Report inaccesible file on failed require (bug #1166504)
* Wed Nov 19 2014 Petr Pisar <ppisar@redhat.com> - 4:5.20.1-314
- Consider Filter::Util::Call dependency as mandatory (bug #1165183)
- Sub-package encoding module