Skip Menu |

This queue is for tickets about the IO-Compress CPAN distribution.

Report information
The Basics
Id: 68002
Status: resolved
Priority: 0/
Queue: IO-Compress

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

Bug Information
Severity: Important
Broken in: 2.034
Fixed in: 2.035



Subject: Oneshot tests fail when temporary file names contain unusual characters
While attempting to install IO-Compress 2.034 under Perl 5.12.3 on Mac OS 10.5.8 (Leopard), I encountered the following errors during the tests: t/105oneshot-bzip2.t ............ 1/987 Nested quantifiers in regex; marked by <-- HERE in m/input file '/var/folders/bH/bHwrvbIq2RWUI++1Yuez9+++ <-- HERE +TI/-Tmp-/uScg7Ucp5L' is a directory/ at t/Test/Builder.pm line 699. # Looks like you planned 987 tests but only ran 10. # Looks like your test died just after 10. t/105oneshot-bzip2.t ............ Dubious, test returned 255 (wstat 65280, 0xff00) Failed 977/987 subtests t/105oneshot-deflate.t .......... 1/987 Nested quantifiers in regex; marked by <-- HERE in m/input file '/var/folders/bH/bHwrvbIq2RWUI++1Yuez9+++ <-- HERE +TI/-Tmp-/qY_OXV7OQd' is a directory/ at t/Test/Builder.pm line 699. # Looks like you planned 987 tests but only ran 10. # Looks like your test died just after 10. t/105oneshot-deflate.t .......... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 977/987 subtests t/105oneshot-gzip-only.t ........ ok t/105oneshot-gzip.t ............. 1/987 Nested quantifiers in regex; marked by <-- HERE in m/input file '/var/folders/bH/bHwrvbIq2RWUI++1Yuez9+++ <-- HERE +TI/-Tmp-/D5AoYZRo9Y' is a directory/ at t/Test/Builder.pm line 699. # Looks like you planned 987 tests but only ran 10. # Looks like your test died just after 10. t/105oneshot-gzip.t ............. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 977/987 subtests t/105oneshot-rawdeflate.t ....... 1/987 Nested quantifiers in regex; marked by <-- HERE in m/input file '/var/folders/bH/bHwrvbIq2RWUI++1Yuez9+++ <-- HERE +TI/-Tmp-/VepuaDzQxL' is a directory/ at t/Test/Builder.pm line 699. # Looks like you planned 987 tests but only ran 10. # Looks like your test died just after 10. t/105oneshot-rawdeflate.t ....... Dubious, test returned 255 (wstat 65280, 0xff00) Failed 977/987 subtests t/105oneshot-zip-bzip2-only.t ... ok t/105oneshot-zip-only.t ......... ok t/105oneshot-zip.t .............. 1/987 Nested quantifiers in regex; marked by <-- HERE in m/input file '/var/folders/bH/bHwrvbIq2RWUI++1Yuez9+++ <-- HERE +TI/-Tmp-/b562S5Raxq' is a directory/ at t/Test/Builder.pm line 699. # Looks like you planned 987 tests but only ran 10. # Looks like your test died just after 10. t/105oneshot-zip.t .............. Dubious, test returned 255 (wstat 65280, 0xff00) Failed 977/987 subtests The issue appears to be that when t/compress/oneshot.pl was modified to let File::Temp generate the file and directory names, it did not take into account the possibility that that the generated names might contain things that would be interpreted by the Perl regular expression engine as meta-characters. Applying the changes given in the attached oneshot.diff file to t/compress/oneshot.pl causes the tests to run cleanly on my OS X system, and also on Ubuntu 11.4 Natty Narwhal.
Subject: oneshot.diff
--- t/compress/oneshot.old 2011-05-06 23:08:53.000000000 -0400 +++ t/compress/oneshot.pl 2011-05-06 23:09:16.000000000 -0400 @@ -84,12 +84,12 @@ $a = $Func->("$dir", \$x) ; is $a, undef, " $TopType returned undef"; - like $$Error, "/input file '$dir' is a directory/", + like $$Error, qr{input file '\Q$dir\E' is a directory}, ' Input filename is a directory'; $a = $Func->(\$x, "$dir") ; is $a, undef, " $TopType returned undef"; - like $$Error, "/output file '$dir' is a directory/", + like $$Error, qr{output file '\Q$dir\E' is a directory}, ' Output filename is a directory'; } @@ -899,7 +899,7 @@ foreach (@files) { writeFile($_, "abc $_") } my @expected = map { "abc $_" } @files ; - my @outFiles = map { s/$tmpDir1/$tmpDir2/; $_ } @files ; + my @outFiles = map { s/\Q$tmpDir1/$tmpDir2/; $_ } @files ; { title "$TopType - From FileGlob to FileGlob files [@$files]" ; @@ -1406,7 +1406,7 @@ foreach (@files) { writeFile($_, compressBuffer($UncompressClass, "abc $_")) } my @expected = map { "abc $_" } @files ; - my @outFiles = map { s/$tmpDir1/$tmpDir2/; $_ } @files ; + my @outFiles = map { s/\Q$tmpDir1/$tmpDir2/; $_ } @files ; { title "$TopType - From FileGlob to FileGlob" ;
STOP THE PRESSES!!! The previous patch makes use of qr{}, which was not introduced until Perl 5.005. But the Makefile.PL specifies 'use 5.004;'. The attachment to this note removes the qr{} in favor of strings. This version of the patch also works under Perl 5.12.3, but I have no way to test under 5.004.
Subject: oneshot.diff
--- t/compress/oneshot.old 2011-05-06 23:08:53.000000000 -0400 +++ t/compress/oneshot.pl 2011-05-06 23:09:16.000000000 -0400 @@ -84,12 +84,12 @@ $a = $Func->("$dir", \$x) ; is $a, undef, " $TopType returned undef"; - like $$Error, "/input file '$dir' is a directory/", + like $$Error, "/input file '\Q$dir\E' is a directory/", ' Input filename is a directory'; $a = $Func->(\$x, "$dir") ; is $a, undef, " $TopType returned undef"; - like $$Error, "/output file '$dir' is a directory/", + like $$Error, "/output file '\Q$dir\E' is a directory/", ' Output filename is a directory'; } @@ -899,7 +899,7 @@ foreach (@files) { writeFile($_, "abc $_") } my @expected = map { "abc $_" } @files ; - my @outFiles = map { s/$tmpDir1/$tmpDir2/; $_ } @files ; + my @outFiles = map { s/\Q$tmpDir1/$tmpDir2/; $_ } @files ; { title "$TopType - From FileGlob to FileGlob files [@$files]" ; @@ -1406,7 +1406,7 @@ foreach (@files) { writeFile($_, compressBuffer($UncompressClass, "abc $_")) } my @expected = map { "abc $_" } @files ; - my @outFiles = map { s/$tmpDir1/$tmpDir2/; $_ } @files ; + my @outFiles = map { s/\Q$tmpDir1/$tmpDir2/; $_ } @files ; { title "$TopType - From FileGlob to FileGlob" ;
Hi Tom. brilliant timing. I've already created a patch for this issue, but I don't have access to OS X to test it. Your patch confirms that my fix should be ok. FYI - The issue was reported in RT# 67931, plus I keep an eye on the smoke tests. The problem is even worse on Windows! I'll close this issue when I see the smokes working on both OS X & Windows. cheers & thanks for taking the time to generate a patch. Paul
Just uploaded 2.035 to CPAN - hopefully that sorts out the issue. Paul
On Sat May 07 04:31:40 2011, PMQS wrote: Show quoted text
> Just uploaded 2.035 to CPAN - hopefully that sorts out the issue. > > Paul
Thanks for the quick response. The update hasn't come through to my mirror yet, but I wanted to acknowledge your work.
IO-Compress 2.035 installed under Mac OS 10.5.8 (Leopard) without problems. Ditto Fedora 14 (Laughlin) and Ubuntu 11.4 (Natty Narwhal), all three with Perl 5.12.3. Thank you very much.
Excellent. I'll resolve this ticket then. Paul