Fix command-line argument quoting in Porting/cmpVERSION.pl
authorSteve Hay <steve.m.hay@googlemail.com>
Fri, 10 Aug 2012 16:54:51 +0000 (17:54 +0100)
committerSteve Hay <steve.m.hay@googlemail.com>
Fri, 10 Aug 2012 16:59:13 +0000 (17:59 +0100)
Windows, NetWare and VMS want double-quotes, other OSes want single quotes.

Porting/cmpVERSION.pl

index 8d39d74..97c78b2 100755 (executable)
@@ -146,6 +146,7 @@ printf "1..%d\n" => scalar keys %module_diffs if $tap;
 
 my $count;
 my $diff_cmd = "git --no-pager diff $tag_to_compare ";
+my $q = ($^O eq 'MSWin32' || $^O eq 'NetWare' || $^O eq 'VMS') ? '"' : "'";
 my (@diff);
 
 foreach my $pm_file (sort keys %module_diffs) {
@@ -166,7 +167,7 @@ foreach my $pm_file (sort keys %module_diffs) {
     } else {
        if ($tap) {
            foreach (sort @{$module_diffs{$pm_file}}) {
-               print "# $_" for `$diff_cmd '$_'`;
+               print "# $_" for `$diff_cmd $q$_$q`;
            }
            if (exists $skip_versions{$pm_file}
                and grep $pm_version eq $_, @{$skip_versions{$pm_file}}) {
@@ -190,6 +191,6 @@ sub get_file_from_git {
 if ($diffs) {
     for (sort @diff) {
        print "\n";
-       system "$diff_cmd '$_'";
+       system "$diff_cmd $q$_$q";
     }
 }