Skip Menu |

This queue is for tickets about the Config-Any CPAN distribution.

Report information
The Basics
Id: 118219
Status: resolved
Priority: 0/
Queue: Config-Any

People
Owner: Nobody in particular
Requestors: gregoa [...] cpan.org
Cc: ether [...] cpan.org
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



From: gregoa [...] cpan.org
Subject: Removal of . from @INC causes problems for Config::Any::Perl
We have the following bug reported to the Debian package of Config-Any (https://bugs.debian.org/839535): It doesn't seem to be a bug in the packaging, so you may want to take a look. Thanks! ------8<-----------8<-----------8<-----------8<-----------8<----- Package: libconfig-any-perl Version: 0.27-1 Severity: normal File: /usr/share/perl5/Config/Any/Perl.pm -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 All of Config::Any's modules used to work with relative paths, but now that . has been removed from @INC, Config::Any::Perl now doesn't. That's because: q{do 'file.pl'} and even q{do 'subdir/file.pl'} now fail (file not found). q{do './file.pl'} and q{do './subdir/file.pl'} both work, though. Also, Config::Any::Perl fails to notice this. It checks $@, which catches when the code doesn't compile, throws an exception, etc., but it needs to also check $! which reports things like file not found. I've also filed a bug against perl about how "do EXPR" no longer behaves as documented, but even if they decide to revert the behavior change, Config::Any::Perl needs to check $!. - -- System Information: Debian Release: stretch/sid APT prefers unstable-debug APT policy: (500, 'unstable-debug'), (500, 'testing'), (500, 'stable'), (130, 'unstable'), (120, 'experimental'), (1, 'experimental-debug') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 4.6.0-1-amd64 (SMP w/8 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Init: systemd (via /run/systemd/system) Versions of packages libconfig-any-perl depends on: ii libmodule-pluggable-perl 5.2-1 ii perl 5.24.1~rc3-3 Versions of packages libconfig-any-perl recommends: ii libconfig-general-perl 2.63-1 ii libconfig-tiny-perl 2.23-1 ii libxml-simple-perl 2.22-1 ii libyaml-libyaml-perl 0.63-1+b1 ii libyaml-perl 1.18-1 ii libyaml-syck-perl 1.29-1+b2 libconfig-any-perl suggests no packages. - -- no debconf information -----BEGIN PGP SIGNATURE----- iFwEARECABwFAlfv5LYVHGFudGhvbnlAZGVyb2JlcnQubmV0AAoJEPs/iMJV6ln+ cHkAnA4nsdkaE1Ugb61I2yUtb28OQ2P4AJ9G30tvNZ0KSq8X5I1Izv0YzhO2Ug== =/nyp -----END PGP SIGNATURE----- ------8<-----------8<-----------8<-----------8<-----------8<----- Thanks for considering, gregor herrmann, Debian Perl Group
Show quoted text
> All of Config::Any's modules used to work with relative paths, but now > that . has been removed from @INC, Config::Any::Perl now doesn't. > > That's because: q{do 'file.pl'} and even q{do 'subdir/file.pl'} now > fail > (file not found). q{do './file.pl'} and q{do './subdir/file.pl'} both > work, though. > > Also, Config::Any::Perl fails to notice this. It checks $@, which > catches when the code doesn't compile, throws an exception, etc., but > it > needs to also check $! which reports things like file not found. > > I've also filed a bug against perl about how "do EXPR" no longer > behaves > as documented, but even if they decide to revert the behavior change, > Config::Any::Perl needs to check $!.
One thing you could do is have the last line of file.pl be "1;", and then you can: do 'file.pl' or die $@; ...which will also die if the file is not found.
On 2016-10-01 22:11:13, ETHER wrote: Show quoted text
> > All of Config::Any's modules used to work with relative paths, but > > now > > that . has been removed from @INC, Config::Any::Perl now doesn't. > > > > That's because: q{do 'file.pl'} and even q{do 'subdir/file.pl'} now > > fail > > (file not found). q{do './file.pl'} and q{do './subdir/file.pl'} both > > work, though. > > > > Also, Config::Any::Perl fails to notice this. It checks $@, which > > catches when the code doesn't compile, throws an exception, etc., but > > it > > needs to also check $! which reports things like file not found. > > > > I've also filed a bug against perl about how "do EXPR" no longer > > behaves > > as documented, but even if they decide to revert the behavior change, > > Config::Any::Perl needs to check $!.
> > One thing you could do is have the last line of file.pl be "1;", and > then you can: > > do 'file.pl' or die $@; > > ...which will also die if the file is not found.
er I mean do './file.pl' or die $@; of course :)
From: anthony [...] derobert.net
Hello! I'm the person who reported this bug to Debian originally. I'm attaching two patches which fix the two things I reported. 0001 fixes the lack of an error check. This should be pretty unobjectionable. 0002 fixes the lack of '.' in @INC by (locally) setting @INC to *only* '.'. I'm guessing the intent was never to look for config files in /usr/lib/x86_64-linux-gnu/perl5/5.24, etc. It's possible that /etc/perl should remain; not sure if it was a goal to load config from there. Also, '.' used to come *last* in @INC, again probably not what was intended, even if /etc/perl should be used.
Subject: 0002-Only-search-CWD-for-Perl-config-files.patch
From: Anthony DeRobertis <anthony@derobert.net> Date: Sat, 8 Oct 2016 02:51:06 -0400 Subject: Only search CWD for Perl config files. Debian has dropped '.' out of @INC as of Stretch, which makes 'do' no longer load Perl config files (unless a full path is given). Probably, the goal was never to search for config files in all the module paths, but only CWD. So set @INC to do so. --- lib/Config/Any/Perl.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/Config/Any/Perl.pm b/lib/Config/Any/Perl.pm index 8e8debc..b56b3f7 100644 --- a/lib/Config/Any/Perl.pm +++ b/lib/Config/Any/Perl.pm @@ -48,6 +48,7 @@ sub load { my( $exception, $error, $content ); { local ($@, $!); + local @INC = ('.'); $content = do $file; $error = $!; $exception = $@;
Subject: 0001-do-Check-for-errors-not-just.patch
From: Anthony DeRobertis <anthony@derobert.net> Date: Sat, 8 Oct 2016 02:35:00 -0400 Subject: do: Check $! for errors, not just $@. 'do' reports errors like 'file not found' in $!, not $@. Previously, those errors were completely ignored. --- lib/Config/Any/Perl.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Config/Any/Perl.pm b/lib/Config/Any/Perl.pm index 28ad0c1..8e8debc 100644 --- a/lib/Config/Any/Perl.pm +++ b/lib/Config/Any/Perl.pm @@ -45,12 +45,14 @@ sub load { my $class = shift; my $file = shift; - my( $exception, $content ); + my( $exception, $error, $content ); { - local $@; + local ($@, $!); $content = do $file; + $error = $!; $exception = $@; } + die $error if $error; die $exception if $exception; return $content;
I found that MooseX::SimpleConfig's tests fail in a no-dot-in-INC build due to use of this module -- see http://www.cpantesters.org/cpan/report/12ecb0d8-e9f0-11e6-8827-94ffe8b01690
This should be resolved in 0.29.