[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

Pathtools QNX regression (was Re: perl@34300)



On Fri, Sep 26, 2008 at 09:40:39AM -0700, Matt Kraai wrote:
> On Fri, Sep 26, 2008 at 11:28:47AM +0100, Nicholas Clark wrote:
> > On Wed, Sep 24, 2008 at 09:19:45AM -0700, Matt Kraai wrote:
> > > When I run "make test" against perl@34300 on QNX 6.3.2, the following
> > > tests fail:
> > > 
> > >     ../ext/Cwd/t/cwd.t
> > >     ../lib/File/Path.t
> > >     ../lib/File/Spec/t/Spec.t
> > >     ../lib/File/Spec/t/crossplatform.t
> > >     ../lib/Time/Local.t
> > >     op/readline.t
> > > 
> > > This is a proper subset of the tests that fail on blead.
> > 
> > Thanks for the report
> > 
> > Is the full output from those tests available online anywhere? A search of my
> > inbox didn't reveal anything obvious.
> 
> I'm not sure what the full output is, but I've attached what was
> output by "./perl harness" when I ran it in the t subdirectory.
> 
> > Do the same tests fail on QNX 6.3.2 for a build of 5.8.8? ie are we looking at
> > regressions here, or never-been-fixed problems?
> 
> The following tests fail for a build of 5.8.8:
> 
> 	../ext/Cwd/t/cwd.t
> 	../ext/Time/HiRes/t/HiRes.t
> 	../lib/Time/Local.t
> 	op/readline.t
> 
> Thus, the regressions are
> 
> 	../lib/File/Path.t
> 	../lib/File/Spec/t/Spec.t
> 	../lib/File/Spec/t/crossplatform.t

> ../lib/File/Spec/t/crossplatform...............
> #   Failed test 'Unix->abs2rel(//foo/bar/file, //foo/)'
> #   at ../lib/File/Spec/t/crossplatform.t line 75.
> #          got: '../bar/file'
> #     expected: 'bar/file'
> 
> #   Failed test 'Unix->abs2rel(//foo/bar/file, //foo/)'
> #   at ../lib/File/Spec/t/crossplatform.t line 80.
> #          got: '../bar/file'
> #     expected: 'bar/file'
> 
> #   Failed test 'Unix->abs2rel(//foo/bar/file, //foo/)'
> #   at ../lib/File/Spec/t/crossplatform.t line 85.
> #          got: '../bar/file'
> #     expected: 'bar/file'
> 
> #   Failed test 'Unix->abs2rel(//foo/bar/file, //foo/)'
> #   at ../lib/File/Spec/t/crossplatform.t line 91.
> #          got: '../bar/file'
> #     expected: 'bar/file'
> 
> #   Failed test 'Unix->abs2rel(//foo/bar/file, //foo/)'
> #   at ../lib/File/Spec/t/crossplatform.t line 96.
> #          got: '../bar/file'
> #     expected: 'bar/file'
> 
> #   Failed test 'Unix->abs2rel(//foo/bar/file, //foo/)'
> #   at ../lib/File/Spec/t/crossplatform.t line 101.
> #          got: '../bar/file'
> #     expected: 'bar/file'
> # Looks like you failed 6 tests of 71.
> dubious
> 	Test returned status 6 (wstat 1536, 0x600)
> DIED. FAILED tests 46-51
> 	Failed 6/71 tests, 91.55% okay (less 10 skipped tests: 55 okay, 77.46%)

Turns out that this was a regression caused by a refactoring of
File::Spec::Unix::abs2rel between Pathtools 3.12 and 3.13

It's possible to make the test fail on any Unix (if not any OS) with:

perl -Ilib -e '$^O = "qnx"; do shift' t/crossplatform.t

The simplest fix seems to be to change File::Spec::Unix::canonpath so that
it canonicalises

    //foo/

as

    //foo

on QNX (and nto. What is nto? Or at least, what sets $^O to 'nto' and is it
related to QNX?)

Is this valid on QNX? Are "//foo/" and "//foo" equivalent?

If so, the appended patch would fix it.

Ken, if it's valid, would it be viable to have a 3.28 release with it in soon?

> ../lib/File/Spec/t/Spec........................# Test 38 got: "//d2/d3" (../lib/File/Spec/t/Spec.t at line 769 fail #38)
> #    Expected: "/d2/d3" (File::Spec::Unix->catdir('/','d2/d3'))
> #  ../lib/File/Spec/t/Spec.t line 769 is:     ok $got, $expected, $function;
> # Test 59 got: "../t2/t3" (../lib/File/Spec/t/Spec.t at line 769 fail #59)
> #    Expected: "t2/t3" (File::Spec::Unix->abs2rel('t1/t2/t3', 't1'))
> # Test 60 got: "../../t1/t2/t3" (../lib/File/Spec/t/Spec.t at line 769 fail #60)
> #    Expected: "../t1/t2/t3" (File::Spec::Unix->abs2rel('t1/t2/t3', 't4'))
> FAILED tests 38, 59-60
> 	Failed 3/561 tests, 99.47% okay (less 90 skipped tests: 468 okay, 83.42%)

Whilst it's a new test failure, it isn't actually a functional regression.
The test in question was added in or around Pathtools 3.18:
http://public.activestate.com/cgi-bin/perlbrowse/p/28001

For all the versions I can test:

$ perl -Ilib -MFile::Spec::Unix -le '$^O = "qnx"; print File::Spec::Unix->catdir("/","d2/d3")'
//d2/d3

(early versions use a //t flag on regexps that I was completely unaware of,
but is, understandably, a syntax error on any perl I have compiled)

I'm not sure what the fix is.

Nicholas Clark

--- lib/File/Spec/Unix.pm.orig  2008-07-26 03:17:30.000000000 +0100
+++ lib/File/Spec/Unix.pm       2008-10-04 22:10:39.000000000 +0100
@@ -50,7 +50,8 @@ sub canonpath {
     # more than two leading slashes shall be treated as a single slash.")
     my $node = '';
     my $double_slashes_special = $^O eq 'qnx' || $^O eq 'nto';
-    if ( $double_slashes_special && $path =~ s{^(//[^/]+)(?:/|\z)}{/}s ) {
+    if ( $double_slashes_special
+         && ( $path =~ s{^(//[^/]+)/?\z}{}s || $path =~ s{^(//[^/]+)/}{/}s ) ) {
       $node = $1;
     }
     # This used to be


Follow-Ups from:
Nicholas Clark <nick@ccl4.org>
Nicholas Clark <nick@ccl4.org>
Matt Kraai <kraai@ftbfs.org>
Matt Kraai <kraai@ftbfs.org>

[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]