Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Path-Class CPAN distribution.

Maintainer(s)' notes

I prefer that bugs & patches are filed on GitHub rather than on RT: https://github.com/kenahoo/Path-Class/issues. Thanks.

Report information
The Basics
Id: 83203
Status: open
Priority: 0/
Queue: Path-Class

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

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



Subject: parent incorrect with trailing updir
It looks like parent for dir() is just truncating a piece, which is incorrect if the last entry is "..". It should append another ".." instead, I believe. $ perl -MPath::Class -wE '$f=dir("/foo/bar/.."); $p = $f->parent; say $p' /foo/bar FWIW: This is perl 5, version 16, subversion 1 (v5.16.1) built for darwin-2level
That's an interesting question. I'm not so sure that's what it should do, arguably the parent of '/foo/bar/..' is indeed '/foo/bar', at least if one follows the Unix directory links. Are there practical issues suggesting one way or the other?
Subject: Re: [rt.cpan.org #83203] parent incorrect with trailing updir
Date: Thu, 7 Feb 2013 18:39:07 -0500
To: bug-Path-Class [...] rt.cpan.org
From: David Golden <dagolden [...] cpan.org>
On Thu, Feb 7, 2013 at 6:22 PM, Ken Williams via RT <bug-Path-Class@rt.cpan.org> wrote: Show quoted text
> That's an interesting question. I'm not so sure that's what it should do, > arguably the parent of '/foo/bar/..' is indeed '/foo/bar', at least if one > follows the Unix directory links.
/foo/bar/.. is /foo as long as symlinks aren't in the picture. E.g. assuming /tmp/bar exists, then "mkdir /tmp/bar/../baz" from the shell will create /tmp/baz. I think dir("/foo/bar/..")->parent should be "/foo/bar/../..". If someone wants to sort out the updirs, they can call resolve, after all. It's probably relevant for something like dir("/foo/bar/../baz") -- if someone calls parent twice, they should get "/foo/bar/../.." not "/foo/bar" as they do now. David -- David Golden <dagolden@cpan.org> Take back your inbox! → http://www.bunchmail.com/ Twitter/IRC: @xdg