Skip Menu |

This queue is for tickets about the Find-Lib CPAN distribution.

Report information
The Basics
Id: 68967
Status: open
Priority: 0/
Queue: Find-Lib

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

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



Subject: Getting the current directory from $ENV{PWD} is incorrect
$ENV{PWD} is only set by shells - if you do "chdir $somewhere_else" in perl, it will not be picked up. (Also, I think it's not very portable.) It should be using the Cwd module instead.
On Mon Jun 20 23:39:09 2011, DOY wrote: Show quoted text
> $ENV{PWD} is only set by shells - if you do "chdir $somewhere_else" in > perl, it will not be picked up. (Also, I think it's not very portable.) > It should be using the Cwd module instead.
1.03_01 on cpan defaults to Cwd::cwd if $ENV{PWD} is not set. Cwd always resolves symlinks which will break Find::Lib on unix
No, this is still broken. The reason I ran into this bug was when I ran a script which did a chdir, and Find::Lib returned the pre-chdir directory because it got it from $ENV{PWD} which isn't updated by perl's chdir(). $ENV{PWD} *cannot* be relied upon in any cases for this to be correct.
On Wed Jun 29 16:03:20 2011, DOY wrote: Show quoted text
> No, this is still broken. The reason I ran into this bug was when I ran > a script which did a chdir, and Find::Lib returned the pre-chdir > directory because it got it from $ENV{PWD} which isn't updated by perl's > chdir(). $ENV{PWD} *cannot* be relied upon in any cases for this to be > correct.
Can you provide a test case or a little background on what program does that? It must be something very specific to do a chdir before even loading fully @INC. (Cwd::chdir updates $ENV{PWD}) Thanks
The actual place I ran into this bug was when trying to install a module that used Find::Lib in its test suite. cpanm first does chdir into the dist build directory, and then runs (among other things) system("make test"). This runs the tests in a new subprocess, which is why no modules have been loaded yet. $ENV{PWD} is still pointing back to the directory I ran cpanm from (because chdir() doesn't update that), but the current working directory of the test process actually is the dist's build root, and that's what needs to be used.
On Fri Jul 01 08:59:07 2011, DOY wrote: Show quoted text
> The actual place I ran into this bug was when trying to install a module > that used Find::Lib in its test suite. cpanm first does chdir into the > dist build directory, and then runs (among other things) system("make > test"). This runs the tests in a new subprocess, which is why no modules > have been loaded yet. $ENV{PWD} is still pointing back to the directory > I ran cpanm from (because chdir() doesn't update that), but the current > working directory of the test process actually is the dist's build root, > and that's what needs to be used.
Yeah, I suggested that cpanm uses Cwd::chdir which seems to be best practice: https://github.com/miyagawa/cpanminus/commit/36d76b5a35a883df53e4339bad350d670e9 dade0