New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
abs_path dies on Windows when called with non-existent path #12693
Comments
From @stscCreated by @stsc#!perl use strict; use Cwd qw(abs_path); $| = 1; print "rel2abs:\t"; print "abs_path:\t"; __OUTPUT__ C:\>perl path.pl According to fail reports from CPAN testers for Hook-Output-File-0.07, Perl Info
|
From @jkeenanOn Tue, 08 Jan 2013 00:08:06 GMT, stsc@refcnt.org wrote:
Since this ticket has not garnered a response in four years, I am attaching the OP's test program for better viewability. When I ran it on Linux, I got the same output as the OP: ##### $ perl 116332-path.pl Could we get this run on various flavors of Windows? Thank you very much.
-- |
From @jkeenan#!perl
use strict;
use warnings;
use Cwd qw(abs_path);
use File::Spec;
$| = 1;
print "rel2abs:\t";
print File::Spec->rel2abs('not_exists'), "\n";
print "abs_path:\t";
print abs_path('not_exists'), "\n";
|
The RT System itself - Status changed from 'new' to 'open' |
From itcharlie@gmail.comPath doesn't display on Windows 10 Strawberry Perl 5.24.1 Powershell Output: PS C:\Users\cgonzalez\Desktop> perl .\path.pl FYI I also tried Command Prompt DOS and it was the same output. |
This comment has been minimized.
This comment has been minimized.
From nanis@cpan.orgAs I discussed here[1], this happens because of the pure Perl version For Dancer, I recommended using File::Spec->rel2abs[2]. [1]: https://www.nu42.com/2010/05/why-cant-i-get-dancers-version-from.html |
So can we just alter Cwd.pm to use File::Spec on windows? |
No, rel2abs is a different operation, it does not consult the filesystem. |
FWIW, Win 10, Strawb 5.30 - different error from abs_path:
|
On Windows, abs_path maps to fast_abs_path in Cwd.pm. Looks like commit a97021b (shipped in 5.28) changed this function from croaking to returning undef. |
On Linux, abs_path uses bsd_realpath in Cwd.xs, which is documented to:
Technically, the problem in this ticket - abs_path dies on Windows - has been fixed. But the behaviour of abs_path still differs between platforms. Should the behaviours be made consistent and if so, which way around? PS Other platform variants:
|
Migrated from rt.perl.org#116332 (status was 'open')
Searchable as RT116332$
The text was updated successfully, but these errors were encountered: