Skip Menu |

This queue is for tickets about the ExtUtils-Install CPAN distribution.

Report information
The Basics
Id: 72734
Status: open
Priority: 0/
Queue: ExtUtils-Install

People
Owner: Nobody in particular
Requestors: a.nikolayew [...] sap.com
mca1001 [...] users.sourceforge.net
Cc:
AdminCc:

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



Subject: ExtUtils::Installed fails to read packlist for relative @INC elements
The symptom is that packlists loaded from relative @INC elements contain no keys. This occurred for me after "use lib 't/tlib'" but I believe some people use non-absolute paths in PERL5LIB for production code, not least q{.}. These are fine until @INC is used after chdir. I've written a failing test at https://gist.github.com/1394091 but no patch (sorry). The likely cause seems to be not telling File::Find to "no_chdir". I suspect the chdir()s also impact performance on large trees (based on some ad-hoc stats, included), but I haven't tried without. A workaround is to pass absolute paths using inc_override. [Sadly for my use, ExtUtils::Installed would be ideal but the large I/O burden and very likely lack of .packlist files (e.g. in binary-installed Perls) mean I need a different solution anyway. Thank you for providing it, and I hope this is useful.] -- Matthew
Subject: Patched, Re: [rt.cpan.org #72734] ExtUtils::Installed fails to read packlist for relative @INC elements
Date: Sun, 27 Nov 2011 12:24:44 +0000
To: Bugs in ExtUtils-Install via RT <bug-ExtUtils-Install [...] rt.cpan.org>
From: Matthew Astley <mca1001 [...] users.sourceforge.net>
On Sat, Nov 26, 2011 at 08:02:09AM -0500, Bugs in ExtUtils-Install via RT wrote: Show quoted text
> I've written a failing test at https://gist.github.com/1394091 but > no patch (sorry).
It's a small fix to avoid chdir - patch is attached and the gist contains the whole tree. Sorry, I didn't find the home VC tree (didn't look very hard for it). I haven't yet tested the performance on our large NFS tree. -- Matthew
git diff v1.54 gist lib/ExtUtils/Installed.pm diff --git a/lib/ExtUtils/Installed.pm b/lib/ExtUtils/Installed.pm index 9cb1fc1..6551617 100644 --- a/lib/ExtUtils/Installed.pm +++ b/lib/ExtUtils/Installed.pm @@ -17,7 +17,7 @@ my $DOSISH = ($^O =~ /^(MSWin\d\d|os2|dos|mint)$/); require VMS::Filespec if $Is_VMS; use vars qw($VERSION); -$VERSION = '1.999_001'; +$VERSION = '1.999_002'; $VERSION = eval $VERSION; sub _is_prefix { @@ -176,7 +176,8 @@ sub new { # Read the module packlists my $sub = sub { # Only process module .packlists - return if $_ ne ".packlist" || $File::Find::dir eq $archlib; + my (undef, undef, $file) = File::Spec->splitpath($File::Find::name); + return if $file ne ".packlist" || $File::Find::dir eq $archlib; # Hack of the leading bits of the paths & convert to a module name my $module = $File::Find::name; @@ -196,7 +197,7 @@ sub new { while (@dirs) { $root= shift @dirs; next if !-d $root; - find($sub,$root); + find({ wanted => $sub, no_chdir => 1 }, $root); } return $self;
Hello all. Feedback offered herein to the Queue readers by another user (NOT a maintainer, at this time) of the ExtUtils-Install modules (there are 3: Install.pm, Installed.pm, Packlist.pm), in reply to: [Sat Nov 26 08:02:08 2011] MCAST: ["ExtUtils::Installed fails to read packlist for relative @INC elements"] Show quoted text
> The symptom is that packlists loaded from relative @INC elements contain > no keys.
I would want there to be no packlists searched for any relative path spec found in @INC. The concept of "installed" that is explicit in the tool we are addressing, ExtUtils::Installed, implies to me that one desires the code to locate and return results pertaining to *installed* package files; e.g. ones which most reasonable invocations of the perl interpreter will find when the "require" or "use" directive is invoked. A path spec in an arbitrary place in the filesystem is not, by definition, reliably "installed." A relative path depends on the cwd which is by definition, again, arbitrary. I wouldn't know, at this time, how to explain that more clearly. Show quoted text
> This occurred for me after "use lib 't/tlib'" but I believe some people > use non-absolute paths in PERL5LIB for production code, not least q{.}. > These are fine until @INC is used after chdir.
[...] As someone who develops on Open Source *nix-like OSes and M$WhyneDos, I have clearly got too limited experience to know whether that is *ever* true or not. In my work, the only relative path spec that ever appears in @INC in production code is ".", the current directory, and it is there only because by default, perl appends it to @INC. It was never reasonable for ExtUtils::Installed to search "." as part of the codepath for discovering *installed* modules. In fact it is a bug that has existed for a long time since the module was first released as part of the Perl Toolchain, that is would fail to skip "." (see more below). It would, by extension, not be reasonable [or let's say desirable just so I can *sound* reasonable]) for EU::Installed to search any relative path spec whatsoever. Although (at time of this writing) there's no sync between the CPAN code and the Perl core code ...the Perl core from for ex. 5.16.1 has a revision of EU::Installed that adds a new parameter for the constructor: skip_cwd ...and this new parameter suggests maintainers of Perl share the view that looking in the (arbitrary) "." pathspec is undesirable (or, perhaps more realistically -- since it wasn't made a default -- we can say that "they demonstrate the awareness that some people have been complaining"). See http://perldoc.perl.org/5.16.1/ExtUtils/Installed.html In summary: Aside from the odd contortions that go hand in hand with writing test code for releases of perl modules (all bets are off, there), I can see no rationalization for wanting EU::Installed to be changed so as to return populated packlist objects for relative (and therefore arbitrary) path spec -based searches. If EU::Installed was changed to support in any sense what the OP seems to have wanted, *I* would in turn feel obliged to start making bug reports *against* such changes. And EU::Installed is part of the Perl core distribution as part of the Perl Toolchain that is relied upon to "install" reusable Perl (library) modules. It has long been integral with, for example, the workings of EU::MakeMaker. As such it is appropriate to take a strict view of what the module does and how it does it. Regarding it as a general-purpose tool for reporting or manipulating any files related to Perl in anyone's (possibly idiosyncratic) notion of what needs to be located, is not an approach that is compatible with its role in the larger "CORE" context. Show quoted text
> [Sadly for my use, ExtUtils::Installed would be ideal but the large I/O > burden and very likely lack of .packlist files (e.g. in binary-installed > Perls) mean I need a different solution anyway. Thank you for providing > it, and I hope this is useful.]
I believe that this is the right conclusion for you to have reached, even if for reasons that as given, I don't all agree with, and I wish you luck. -- somian ^AT^ CPAN -DOT- org Also email somian08 ^AT^ gmail -DOT- com.
Subject: rt.cpan.org #72734
Date: Fri, 7 Apr 2017 02:22:14 +0000
To: "bug-ExtUtils-Install [...] rt.cpan.org" <bug-ExtUtils-Install [...] rt.cpan.org>
From: "Nikolayew, Alex" <a.nikolayew [...] sap.com>
I ran into this problem just trying to perform a basic Configure/build/test of perl 5.22.x: not ok 32 - new() should find modules with .packlists # Failed test 'new() should find modules with .packlists' # at ./Installed.t line 172. not ok 33 - undef isa 'ExtUtils::Packlist' # Failed test 'undef isa 'ExtUtils::Packlist'' # at ./Installed.t line 173. # undef isn't defined not ok 34 - ... should find version in modules # Failed test '... should find version in modules' # at ./Installed.t line 174. # got: undef # expected: '1.1.1' Manual test confirms mca1001’s hypothesis: $ pwd /var/build/git/perl/auto/build.5.22.2/perl-5.22.2/cpan/ExtUtils-Install/t $ PERL5LIB=auto/FakeMod perl -MExtUtils::Installed -e '$mods=ExtUtils::Installed->new(skip_cwd => 1); for $m ($mods->modules()) { print "module: $m\n"; }' |grep Fake $ PERL5LIB=`pwd`/auto/FakeMod perl -MExtUtils::Installed -e '$mods=ExtUtils::Installed->new(skip_cwd => 1); for $m ($mods->modules()) { print "module: $m\n"; }' |grep Fake module: build.5.22.2::perl-5.22.2::cpan::ExtUtils-Install::t::auto::FakeMod But simply appending an absolute PERL5LIB path is not enough to pass the Installed.t test because the test looks for a module named “FakeMod”, but as can be seen in my output above, the full lib path gets appended to the module name. Amazing that this has not been fixed in 5+ years! Alex Nikolayew DevOps Engineer SAP Ariba