At 1:08 PM -0500 9/1/07, John E. Malmberg wrote:
>Craig A. Berry wrote:
>>At 12:10 AM -0500 8/31/07, John E. Malmberg wrote:
>>
>>>This patch makes the following changes:
>>>
>>>In lib/Archive/Tar.pm, currently Perl on VMS can not fully deal
>>>with  directory specifications that have C<.> characters in them.
> >> Internally the VMS.C module currently translates them to C<_>
>>> characters.

Yes, specifically File::Spec::VMS->catdir does not properly handle
the case where one of the directories has a dot in its name.  But
then File::Spec::Unix->catdir does not properly handle the case where
one of the directories has a forward slash in its name, though it
fails less spectacularly than its VMS counterpart.  Using directory
delimiters in directory names is just evil, the problem being that
CPAN and a lot of other places have always blissfully practiced this
evil unawares.

>>>File::Spec on VMS can not currently handle the UNIX pathnames that
>>>are  showing up here, so use the UNIX routines and keep everything in
>>>UNIX syntax. One of the failures is handling empty path elements.

There was no reason for VMS-specific parts of File::Spec to be
dealing with UNIX pathnames.  In fact, replacing dots with
underscores was the only VMS-specific change necessary; otherwise the
problems just boiled down to using splitpath and splitdir in the
right places and in a way that (hopefully) works everywhere.  The
attached patch checks  out on VMS and Mac OS X, and also knocks out a
few test failures on VMS.  With any luck it won't break Windows.
Here are the changes, all to Archive::Extract::_extract_file:

-- After calling the UNIX-specific version of splitpath, also call
the UNIX-specific (rather than the generic) version of splitdir on
the resulting directory portion.

-- When breaking down the current working directory into its
components, use both splitpath and splitdir (just as with any other
full path spec).

-- The pod for Archive::Tar::extract_file differed from the code in
that it said its second argument, an alternate "extract-to" location,
was expected to be in Unix syntax.  The code and at least one comment
in it made clear it was really expected to be a native path.  I've
made the code follow through on that more consistently and modified
the pod to match.

I've committed this to blead as #31788, but given the drum roll for
5.10, if Rafeal or Jos doesn't like it, I can revert it and evaluate
then whether there is time to try again with something better.

>>>In lib/Archive/Tar/t/02_methods.t, File::Spec->catfile was being
>>>used  where a directory path was needed. There is a significant difference
>>>between catpath and catfile on VMS, and catpath must be used if the
>>>result is intended to be a path.
>>
>>But you replaced catfile with catdir, not catpath.  In any case,
>>catfile looks right to me as it appears to be generating a file name,
>>not a directory name.
>
>I meant to type catdir not catpath there.

Either way, it definitely needed to be a file, not a directory, so
I've left it as catfile and fixed the underlying problem instead.

>BTW: Two of my posts that I cc: to you just bounced, but it appears that you 
>have responded to one of them.

I get a lot of mail, including a fair amount from you lately :-).  So
I don't think there is a general problem on my end.
-- 
________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser

Attachment: archive_tar_extract.patch
Description: Binary data

Reply via email to