Skip Menu |

This queue is for tickets about the PathTools CPAN distribution.

Report information
The Basics
Id: 96190
Status: open
Priority: 0/
Queue: PathTools

People
Owner: Nobody in particular
Requestors: JBenton [...] algebraixdata.com
Cc:
AdminCc:

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



Subject: incorrect absolute path generated for windows
Date: Tue, 3 Jun 2014 22:24:53 +0000
To: "bug-pathtools [...] rt.cpan.org" <bug-pathtools [...] rt.cpan.org>
From: Jeff Benton <jbenton [...] algebraixdata.com>
Perl 5.16.3, ActiveState, 64bit running on Windows 7 Professional. PathTools 3.47 Path::Class 0.33 File::pushd 1.007 Copy the following script to your user home directory, c:\users\<username> and run it use Path::Class; use File::pushd; my $path = dir('C:\Windows'); my $initialDir = pushd($path); print "changed to $initialDir\n"; The result: Can't chdir to c:\Users/C:\Windows: No such file or directory at path-test-failing2.t line 5. This was a pretty difficult issue to track down because when you run in debug mode, it works. I was able to trace it down to the behavior around Cwd::abs_path. If I hacked File::pushd and referred to Cwd::fast_abs_path instead of abs_path at line 43, the script works. Also, if I did not use Path::Class and just passed in a string, the script worked. With the 3.40 versions of Cwd and File::Spec I do not get this issue. Regards, Jeff Benton
From: Martin.Schlemmer [...] nwu.ac.za
I have the same problem, with the same setup, except for 32bit perl on 64bit Win7. Interestingly enough, this was working fine without debugging, but in Komodo IDE its injected code for debugging broke my program's use of FindBin (which uses abs_path) to setup lib path - so yeah, had some fun running around tracing it to PathTools from FindBin :) Anyway, the problem looks to be the new XS bits for File::Spec. If File::Spec is booted before Cwd, then Cwd do not setup abs_path, etc. correctly: ----- C:\opt\workdir\PathTools-3.47>perl -w -MFile::Spec -MCwd -e "print Cwd::abs_path( cwd() );" Subroutine Cwd::bootstrap redefined at C:/Perl/lib/DynaLoader.pm line 207. Subroutine Cwd::CLONE redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine Cwd::fastcwd redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine Cwd::getcwd redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine Cwd::abs_path redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine Cwd::getdcwd redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine File::Spec::Unix::canonpath redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine File::Spec::Unix::_fn_canonpath redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine File::Spec::Unix::catdir redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine File::Spec::Unix::_fn_catdir redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine File::Spec::Unix::catfile redefined at C:/Perl/lib/DynaLoader.pm line 214. Subroutine File::Spec::Unix::_fn_catfile redefined at C:/Perl/lib/DynaLoader.pm line 214. C:\opt\workdir\PathTools-3.47/C:/opt/workdir/PathTools-3.47 C:\opt\workdir\PathTools-3.47> ----- I can see two ways to fix this: - Split the XS into two modules - Only load the XS in Cwd (see attached patch, which works here) With Patch: ----- C:\opt\workdir\PathTools-3.47>perl -w -MFile::Spec -MCwd -e "print Cwd::abs_path( cwd() );" C:/opt/workdir/PathTools-3.47 ----- Comments appreciated.
Subject: PathTools-3.47-require-cwd-in-file_spec.patch
diff -uprN PathTools-3.47.orig/lib/File/Spec/Unix.pm PathTools-3.47/lib/File/Spec/Unix.pm --- PathTools-3.47.orig/lib/File/Spec/Unix.pm 2014-05-23 18:39:28 +0200 +++ PathTools-3.47/lib/File/Spec/Unix.pm 2014-06-20 14:44:58 +0200 @@ -9,7 +9,9 @@ $VERSION =~ tr/_//; unless (defined &canonpath) { eval { - if ( $] >= 5.006 ) { + # XXX: If we load this here, Cwd do not do the needed setup, and abs_path() + # fails on Win32. See bug #96190. + if ( 0 && $] >= 5.006 ) { require XSLoader; XSLoader::load("Cwd", $xs_version); } else {
This isn't a bug in Cwd, it's a bug in ActiveState Perl. They have a system for overloading values from Config.pm, but it loads a bunch of modules, which causes issues if those modules try to use DynaLoader (which uses Config.pm).