Paul Cochrane wrote:
> On 11/06/07, Ron Blaschke <[EMAIL PROTECTED]> wrote:
>> jerry gay wrote:
>> > On 6/11/07, Paul Cochrane <[EMAIL PROTECTED]> wrote:
>> >> On 09/03/07, chromatic <[EMAIL PROTECTED]> wrote:
>> >> > On Friday 09 March 2007 05:00, Ron Blaschke wrote:
>> >> >
>> >> > > Attached patch replaces the backslashes with slashes on Windows.
>> >> >
>> >> > Would using File::Spec be less fragile?
>> >>
>> >> I've attached a patch which uses File::Spec instead of replacing one
>> >> set of slashes with another.  Comments welcome!  :-)
>> >>
>> > good idea.
>> >
>> > instead of breaking up the path and reconstructing it separately
>> > (since the individual components of the path aren't used anywhere
>> > else,) how about using 'canonpath' to clean up the path in one step.
>> > something like:
>> >
>> >                if ( $result =~ m{(.*) - (.*)} ) {
>> >                    my $file = canonpath $1;
>> >                    my $attribute = $2;
>> >
>> >                    # and add to the results hash
>> >                    $results{$file} = $attribute;
>> >                }
>>
>> I may be missing something here, but I think the problem was that the
>> file name sets in MANIFEST and those reported by svn must match up, but
>> didn't because of the file separator.  MANIFEST uses forward slashes,
>> File::Spec those of the current platform, which probably brings you back
>> to square one.
> 
> But if we convert what MANIFEST provides (i.e. Unix directory
> separators) into whatever the current platform needs (i.e. what
> canonpath() does) then it should agree with whatever svn spits out.
> Or am I missing something?

No, that's exactly what I think needs to be done.  In the patch
canonpath is used with the result of the svn execution only.  That's not
enough.  @manifest_files would need to be changed too, otherwise it
contains the file names with forward slashes from MANIFEST.  There's
also a regex $lf_files_regexp that seems to filter files, and the part
that uses it would need to be aware of the changed separator, too.

> Essentially my patch is just a less fragile version of the patch you
> submitted to get this test to work on Windows.  (at least, I don't
> think I'm changing the functionality that much).

I simple changed the backward slashes to forward slashes, thus forward
slashes everywhere.  But canonpath does on Win32:

$ perl -MFile::Spec::Functions=canonpath
    -e "print canonpath 'some\file.t'"
some\file.t

$ perl -MFile::Spec::Functions=canonpath
    -e "print canonpath 'some/file.t'"
some\file.t


Here are the test results with the patch applied on Win32:

$ prove t\distro\file_metadata.t
<many lines snipped>...
#  svn ps svn:eol-style 'LF' examples/shootout/takfp.pir.output;
#  svn ps svn:eol-style 'LF' t/compilers/pge/p5regex/re_tests;
#  svn ps svn:eol-style 'LF' t/library/perlhist.txt;
#  svn ps svn:eol-style 'LF' t/op/sprintf_tests;
# '
#     expected: ''
# Looks like you failed 4 tests of 4.
t\distro\file_metadata....dubious
        Test returned status 4 (wstat 1024, 0x400)
DIED. FAILED tests 1-4
        Failed 4/4 tests, 0.00% okay
Failed Test              Stat Wstat Total Fail  Failed  List of Failed
-------------------------------------------------------------------------------
t\distro\file_metadata.t    4  1024     4    4 100.00%  1-4
Failed 1/1 test scripts, 0.00% okay. 4/4 subtests failed, 0.00% okay.

Ron

Reply via email to