Subject: | test bug with external spaces in path to external gzip |
Date: | Thu, 29 Sep 2011 09:20:35 -0400 |
To: | bug-IO-Compress [...] rt.cpan.org |
From: | douglas irvine <dci2112 [...] gmail.com> |
I found a bug in the tests for external gzip program compatibility
(050interop-gzip.t) on windows.
The test assumed that the path to gzip would not contain any spaces, and
hence he system command failed when unquoted space containing path to the
executable was attempted.
The default installation of gzip on Win32 installs to "C:\Program
Files\GnuWin32\bin" which contains a space.
Also, the creation of the path to the external gzip wasn't
platform independent, it used "/" rather than
File::Spec->catfile($dir,$name).
Show quoted text
--- System details ---
Module: IO-Compress-20.37
Perl: v5.8.9 for MSWin32-x86-multi-thread (strawberry perl)
OS: Windows XP SP 3
--- patch to 2.037 (from diff -Nau original new) ---
--- /Users/dirvine/Downloads/IO-Compress-2.037/t/050interop-gzip.t
2009-02-04 15:37:46.000000000 -0500
+++ 050interop-gzip.t 2011-09-29 08:55:20.000000000 -0400
@@ -10,6 +10,8 @@
use warnings;
use bytes;
+use File::Spec;
+
use Test::More ;
use CompTestUtils;
@@ -91,10 +93,13 @@
for my $dir (reverse split $split, $ENV{PATH})
{
- $GZIP = "$dir/$name"
- if -x "$dir/$name" ;
+ $GZIP = File::Spec->catfile($dir,$name)
+ if -x File::Spec->catfile($dir,$name);
}
+ #handle spaces in path to gzip
+ $GZIP = "\"$GZIP\"" if ($GZIP =~ / /);
+
plan(skip_all => "Cannot find $name")
if ! $GZIP ;