This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
t/lib/common.pl should use absolute paths in @INC
authorNicholas Clark <nick@ccl4.org>
Wed, 6 Mar 2013 11:40:01 +0000 (12:40 +0100)
committerNicholas Clark <nick@ccl4.org>
Thu, 7 Mar 2013 11:14:14 +0000 (12:14 +0100)
commit96d268e2f48e69b4cb65326df6690ffc21120f3c
tree3a3cf3b55594de05dc73415aa933849f64c3125a
parentec3fc3c1a6073e4315330c1e2a9df8a0d5d9fdb3
t/lib/common.pl should use absolute paths in @INC

t/lib/common.pl needs to run test files within a subdirectory, and hence
needs change directory into it. Changing a directory poses a problem when
running the tests, because @INC is typically '../lib'. The fix for this had
been to prepend '../../lib' to @INC, which is the correct relative path
while in the subdirectory.

However, the END block changes directory upwards (so that it can delete the
temporary directory), and in the process of deletion may end up lazy-loading
more modules. This will end up searching in ../lib first (ie outside the
build directory), which is wrong, and will cause problems if a directory lib/
exists up one level with files of the expected names (eg a lib/ directory
from a different version of Perl).

Problem identified and diagnosed by Daniel Dragan in RT #116971.
t/lib/common.pl