Skip Menu |
 

This queue is for tickets about the File-Spec CPAN distribution.

Report information
The Basics
Id: 90646
Status: open
Priority: 0/
Queue: File-Spec

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

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



Subject: abs2rel returns strange result when $base is not in canonical form
Download (untitled) / with headers
text/plain 594b
File::Spec->abs2rel("/foo/bar/baz", "/foo/bar") returns "baz", as it should. Since "/foo/bar/../bar" is the same , File::Spec->abs2rel("/foo/bar/baz", "/foo/bar/../bar") should mean the same and should return the same. But it returns "../bar/baz". (There might be some argument about what this means if "/foo/bar" is a symlink, say one pointing to "/a/b/c". Then one could argue that "/foo/bar/../bar" resolves to "/a/b/bar" rather than to "/foo/bar". Is that what's happening here? ) I am using File::Spec 3.40. This version number has vanished from the RT "Broken in" menu, because RT.
On Fri Nov 22 16:39:18 2013, MJD wrote: Show quoted text
> File::Spec->abs2rel("/foo/bar/baz", "/foo/bar") returns "baz", as it > should. > Since "/foo/bar/../bar" is the same , File::Spec-
> >abs2rel("/foo/bar/baz", "/foo/bar/../bar") should mean the same and
> should return the same. But it returns "../bar/baz". > > (There might be some argument about what this means if "/foo/bar" is a > symlink, say one pointing to "/a/b/c". Then one could argue that > "/foo/bar/../bar" resolves to "/a/b/bar" rather than to "/foo/bar". > Is that what's happening here? )
I do believe that's what's happening here. I think the behavior you describe is intentional. But I don't think it's abundantly clear from the documentation or method name or anything else. The only thing even tangentially related in the docs is the phrase "No checks against the filesystem are made", implying that there might be a reason to do so, and the only reason I know of is special-case path mappings like symlinks. That stuff is described in the docs for canonpath() though. -Ken


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.