Skip Menu |
 

This queue is for tickets about the PathTools CPAN distribution.

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

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

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



Subject: realpath: different behavior on non-existent directory between Unix and Windows
Download (untitled) / with headers
text/plain 515b
The following test script behaves differently on Windows and Unix (e.g. Linux, FreeBSD): #!/usr/bin/perl -w use strict; use Test::More tests => 2; use Cwd 'realpath'; ok defined realpath '.'; ok defined realpath 'thispathdoesnotexist'; __END__ On Unix the test script passes. On Windows it fails with: thispathdoesnotexist: No such file or directory at t/cwd.t line 9. I would expect that this behaves the same on both systems. The 2nd best solution would be some documentation on the different behavior.
Download (untitled) / with headers
text/plain 1011b
I also just ran into this issue and have some more observations. On *nix: ~# perl -e 'use Cwd; print Cwd::realpath("notexist")."\n"' /root/notexist ~# perl -e 'use Cwd; print Cwd::realpath("/notexist")."\n"' /notexist On Windows: C:\Users\Mithaldu>perl -e "use Cwd;Cwd::realpath('c:\\notexist')" c:\notexist: No such file or directory at -e line 1. C:\Users\Mithaldu>perl -e "use Cwd;Cwd::realpath('notexist')" notexist: No such file or directory at -e line 1. Thoughts regarding which way to resolve this: 1. The documentation does not say anything about exceptions. 2. It does however mention fast_abs_path as being a "potentially more dangerous" version of abs_path, and claims realpath is a synonym for abs_path. So possibly abs_path and realpath may be considered candidates for exceptions. 3. Adding an exception to the linux version would break a lot of code. 4. I did however find this difference because the exception triggered on windows correctly pointed out a bug that went ignored on *nix.
Download (untitled) / with headers
text/plain 189b
Another data point from mst: The docs only say that symlinks, '.' and '..' are resolved, but in a nonexistant file neither are present, so nothing has to be resolved and thus nothing done.
Download (untitled) / with headers
text/plain 110b
This problem has also been reported in the Perl 5 bug queue: https://rt.perl.org/Ticket/Display.html?id=116332


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.