Skip Menu |

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

Report information
The Basics
Id: 30654
Status: resolved
Priority: 0/
Queue: File-Path

People
Owner: dland [...] cpan.org
Requestors: cberry [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: 2.02
Fixed in: 2.04



Subject: [PATCH] rmtree nit when handling file in VMS syntax
Sorry to always be the bearer of ugly exceptions to exceptions, but I've checked the attached into blead as #32276 to get around the following problem. When an individual file already in VMS syntax was passed to rmtree -- and that file was a relative path with at least one directory included in the name -- we were passing an invalid combination of Unix and VMS syntax to vmsify, and getting a garbage result. Basically, for the following two examples, we had to prevent the second one from happening. 'file.dat' --> vmsifiy('./file.dat') '[.foo]file.dat' --> vmsify('./[.foo]file.dat') # garbage in, garbage out
Subject: filepathfix.patch.txt
--- lib/File/Path.pm;-0 Wed Oct 24 08:44:46 2007 +++ lib/File/Path.pm Sat Nov 10 19:50:04 2007 @@ -17,7 +17,7 @@ BEGIN { use Exporter (); use vars qw($VERSION @ISA @EXPORT); -$VERSION = '2.02'; +$VERSION = '2.02_01'; @ISA = qw(Exporter); @EXPORT = qw(mkpath rmtree); @@ -340,7 +340,9 @@ sub _rmtree { # not a directory $root = VMS::Filespec::vmsify("./$root") - if $Is_VMS && !File::Spec->file_name_is_absolute($root); + if $Is_VMS + && !File::Spec->file_name_is_absolute($root) + && ($root !~ m/(?<!\^)[\]>]+/); # not already in VMS syntax if ($arg->{safe} && ($Is_VMS ? !&VMS::Filespec::candelete($root)
On Sun Nov 11 18:40:43 2007, CBERRY wrote: Show quoted text
> Sorry to always be the bearer of ugly exceptions to exceptions, but > I've checked the attached > into blead as #32276 to get around the following problem. When an > individual file already in > VMS syntax was passed to rmtree -- and that file was a relative path > with at least one directory > included in the name -- we were passing an invalid combination of Unix > and VMS syntax to > vmsify, and getting a garbage result. Basically, for the following > two examples, we had to > prevent the second one from happening. > > 'file.dat' --> vmsifiy('./file.dat') > '[.foo]file.dat' --> vmsify('./[.foo]file.dat') # garbage in, garbage > out
I have folded this patch into my local repo, which is now in sync with blead. I added a test for rmtree($file). If you can confirm that the test does not blow up spectacularly on VMS, I'll release to CPAN. Thanks, David
Subject: Re: [rt.cpan.org #30654] [PATCH] rmtree nit when handling file in VMS syntax
Date: Thu, 15 Nov 2007 13:07:17 -0600
To: David Landgren via RT <bug-File-Path [...] rt.cpan.org>
From: "Craig A. Berry" <craigberry [...] mac.com>
David, Everything File::Path related looked good in blead@32308, and your last update (including the new test) went in as 32305, so I'd say we're set. Thanks, Craig Show quoted text
><URL: http://rt.cpan.org/Ticket/Display.html?id=30654 > > >On Sun Nov 11 18:40:43 2007, CBERRY wrote:
>> Sorry to always be the bearer of ugly exceptions to exceptions, but >> I've checked the attached >> into blead as #32276 to get around the following problem. When an >> individual file already in >> VMS syntax was passed to rmtree -- and that file was a relative path >> with at least one directory >> included in the name -- we were passing an invalid combination of Unix >> and VMS syntax to >> vmsify, and getting a garbage result. Basically, for the following >> two examples, we had to >> prevent the second one from happening. >> >> 'file.dat' --> vmsifiy('./file.dat') >> '[.foo]file.dat' --> vmsify('./[.foo]file.dat') # garbage in, garbage >> out
> >I have folded this patch into my local repo, which is now in sync with >blead. I added a test for rmtree($file). If you can confirm that the >test does not blow up spectacularly on VMS, I'll release to CPAN. > >Thanks, >David
-- Show quoted text
________________________________________ Craig A. Berry mailto:craigberry@mac.com "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser
This fix appears in 2.04. Sorry for the late reply, search.cpan.org took a long time to refresh its metadata so that I could add the version in which the module was fixed. Regards, David Landgren