Thorsten Gunkel schrieb:
Hi *,
I have a perl script, which stopped working, when I recently updated cygwin
to 1.7.
Here is a small demo script which shows the problem. It just calls abs_path()
with different values and prints the output. It would be great if anyone
could confirm that they also see this behaviour.
#!/bin/env perl
use strict;
use Cwd 'abs_path';
abs_path_WITHDEBUG(".");
abs_path_WITHDEBUG("C:\\");
abs_path_WITHDEBUG("C:\\Program Files\\");
abs_path_WITHDEBUG("C:\\Does Not Exist\\");
exit;
sub abs_path_WITHDEBUG
{
my $pPath = shift;
my $result_path=abs_path($pPath);
print "Test: \n PrePath={".$pPath."}\nPostPath={".$result_path."}\n\n";
return $result_path;
}
When called with current Perl Version 5.10.1-2 it shows this output:
Test:
PrePath={.}
PostPath={/tmp}
Test:
PrePath={C:\}
PostPath={/tmp/C:\}<--- broken
Test:
PrePath={C:\Program Files\}
PostPath={/tmp/C:\Program Files\}<--- broken
Test:
PrePath={C:\Does Not Exist\}
PostPath={/tmp/C:\Does Not Exist\}<--- broken
Please notice, that the Windows path is justed added to the current
Unix path (which results in a broken path)
When I manually downgrade Perl to Version 5.10.1-1 it shows this output:
Test:
PrePath={.}
PostPath={/tmp}
Test:
PrePath={C:\}
PostPath={/cygdrive/c}
Test:
PrePath={C:\Program Files\}
PostPath={/cygdrive/c/Program Files}
C:\Does Not Exist\: No such file or directory at ./demo.pl line 20
Here I get the correct Unix path in all cases.
The difference seems to be in Cwd.pm:
diff -u -U5 Cwd.pm*
--- Cwd.pm_old 2010-01-12 15:37:19.718007800 +0100
+++ Cwd.pm_new 2010-01-12 15:46:32.159043400 +0100
@@ -303,11 +303,11 @@
cygwin =>
{
getcwd => 'cwd',
fastgetcwd => 'cwd',
fastcwd => 'cwd',
- abs_path => 'fast_abs_path',
+# abs_path => 'fast_abs_path',
realpath => 'fast_abs_path',
},
epoc =>
{
@@ -817,8 +817,8 @@
*abs_path = \&_perl_abs_path unless defined&abs_path;
*getcwd = \&_perl_getcwd unless defined&getcwd;
# added function alias for those of us more
# used to the libc function. --tchrist 27-Jan-00
-*realpath = \&abs_path;
+*realpath = \&abs_path unless defined&realpath;
1;
So abs_path used to point to fast_abs_path, but does not longer for Cygwin?
When I use fast_abs_path instead of abs_path in my test script it works for
both perl versions 5.10.1-1 and 5.10.1-2. What was wrong with fast_abs_path?
Should I just replace abs_path to fast_abs_path?
Yes please, until we come up with a satisfactory solution for all problems.
It was caused by a patch request from Eliott Moss
http://sourceware.org/ml/cygwin/2009-12/msg00506.html for svk,
which caused no regressions in the tests.
I'll talk to Stefan Müller to add such tests to the PathTools package.
--
Reini Urban
http://phpwiki.org/ http://murbreak.at/
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple