@@ -1,5 +1,13 @@
Revision history for Perl extension String::ShellQuote.
+1.04 Mon Jun 7 09:09:36 EDT 2010
+
+ - Don't escape "=" unless it's in command position. Thanks to Chip
+ for the inspiration.
+ - Use "#!perl" in test.t (closes #38072).
+ - Don't try to test or install the shell-quote script on Windows
+ (closes #46445).
+
1.03 Tue May 3 06:47:39 EDT 2005
- Add shell-quote script.
@@ -24,4 +32,4 @@ Revision history for Perl extension String::ShellQuote.
- Initial version.
-$Id: Changes,v 1.5 2005/05/03 10:53:33 roderick Exp $
+$Id: Changes,v 1.6 2010-06-11 20:00:24 roderick Exp $
@@ -1,10 +1,20 @@
-# http://module-build.sourceforge.net/META-spec.html
-#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX#
-name: String-ShellQuote
-version: 1.03
-version_from: ShellQuote.pm
-installdirs: site
-requires:
-
-distribution_type: module
-generated_by: ExtUtils::MakeMaker version 6.17
+--- #YAML:1.0
+name: String-ShellQuote
+version: 1.04
+abstract: ~
+author: []
+license: unknown
+distribution_type: module
+configure_requires:
+ ExtUtils::MakeMaker: 0
+build_requires:
+ ExtUtils::MakeMaker: 0
+requires: {}
+no_index:
+ directory:
+ - t
+ - inc
+generated_by: ExtUtils::MakeMaker version 6.55_02
+meta-spec:
+ url: http://module-build.sourceforge.net/META-spec-v1.4.html
+ version: 1.4
@@ -1,4 +1,4 @@
-# $Id: Makefile.PL,v 1.4 2005/05/03 10:44:03 roderick Exp $
+# $Id: Makefile.PL,v 1.5 2010-06-11 20:00:24 roderick Exp $
#
# Copyright (c) 1997 Roderick Schertler. All rights reserved. This
# program is free software; you can redistribute it and/or modify it
@@ -9,7 +9,11 @@ use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'String::ShellQuote',
VERSION_FROM => 'ShellQuote.pm',
- EXE_FILES => ['shell-quote'],
+ (
+ $^O eq 'MSWin32'
+ ? ()
+ : (EXE_FILES => ['shell-quote'])
+ ),
dist => {
PREOP => '$(MAKE) ci',
CI => 'cvs commit',
@@ -1,4 +1,4 @@
-# $Id: ShellQuote.pm,v 1.9 2005/05/03 10:53:33 roderick Exp $
+# $Id: ShellQuote.pm,v 1.11 2010-06-11 20:08:57 roderick Exp $
#
# Copyright (c) 1997 Roderick Schertler. All rights reserved. This
# program is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@ use vars qw($VERSION @ISA @EXPORT);
require Exporter;
-$VERSION = '1.03';
+$VERSION = '1.04';
@ISA = qw(Exporter);
@EXPORT = qw(shell_quote shell_quote_best_effort shell_comment_quote);
@@ -51,6 +51,7 @@ sub _shell_quote_backend {
return \@err, '' unless @in;
my $ret = '';
+ my $saw_non_equal = 0;
foreach (@in) {
if (!defined $_ or $_ eq '') {
$_ = "''";
@@ -61,10 +62,27 @@ sub _shell_quote_backend {
push @err, "No way to quote string containing null (\\000) bytes";
}
- # = does need quoting else in command position it's a program-local
- # environment setting
+ my $escape = 0;
- if (m|[^\w!%+,\-./:@^]|) {
+ # = needs quoting when it's the first element (or part of a
+ # series of such elements), as in command position it's a
+ # program-local environment setting
+
+ if (/=/) {
+ if (!$saw_non_equal) {
+ $escape = 1;
+ }
+ }
+ else {
+ $saw_non_equal = 1;
+ }
+
+ if (m|[^\w!%+,\-./:=@^]|) {
+ $escape = 1;
+ }
+
+ if ($escape
+ || (!$saw_non_equal && /=/)) {
# ' -> '\''
s/'/'\\''/g;
@@ -1,7 +1,7 @@
-#!/usr/bin/perl -w
+#!perl -w
use strict;
-# $Id: shell-quote,v 1.2 2005/05/03 10:53:01 roderick Exp $
+# $Id: shell-quote,v 1.3 2010-06-11 20:00:24 roderick Exp $
#
# Roderick Schertler <roderick@argon.org>
@@ -25,7 +25,7 @@ use String::ShellQuote qw(shell_quote);
(my $Me = $0 ne '-e' ? $0 : $^X) =~ s-.*/--;
my $Debug = 0;
my $Exit = 0;
-my $Version = q$Revision: 1.2 $ =~ /(\d\S+)/ ? $1 : '?';
+my $Version = q$Revision: 1.3 $ =~ /(\d\S+)/ ? $1 : '?';
my @Option_spec = (
'debug!' => \$Debug,
@@ -1,7 +1,7 @@
#!perl -w
use strict;
-# $Id: test.t,v 1.4 2005/05/03 10:53:33 roderick Exp $
+# $Id: test.t,v 1.6 2010-06-11 20:08:57 roderick Exp $
#
# Copyright (c) 1997 Roderick Schertler. All rights reserved. This
# program is free software; you can redistribute it and/or modify it
@@ -9,7 +9,7 @@ use strict;
BEGIN {
$| = 1;
- print "1..31\n";
+ print "1..33\n";
}
use String::ShellQuote;
@@ -19,10 +19,10 @@ sub ok {
my ($result, @info) = @_;
$test_num++;
if ($result) {
- print "ok $test_num\n";
+ print "ok $test_num\n";
}
else {
- print "not ok $test_num\n";
+ print "not ok $test_num\n";
print "# ", @info, "\n" if @info;
}
}
@@ -60,6 +60,8 @@ test q{\'}, qw(');
test q{'\'\'}, qw(\');
test q{'a'"''"'b'}, qw(a''b);
test q{azAZ09_!%+,-./:@^}, q{azAZ09_!%+,-./:@^};
+test q{'foo=bar' command}, qw(foo=bar command);
+test q{'foo=bar' 'baz=quux' command}, qw(foo=bar baz=quux command);
test
"die: shell_quote(): No way to quote string containing null (\\000) bytes",
"t\x00";
@@ -86,8 +88,8 @@ sub via_shell {
defined $pid
or return "can't fork: $!\n";
if (!$pid) {
- if (!open STDERR, '>&STDOUT') {
- print "$0: can't dup stdout: $!\n";
+ if (!open STDERR, '>&STDOUT') {
+ print "$0: can't dup stdout: $!\n";
exit 1;
}
exec $cmd, @args
@@ -100,8 +102,12 @@ sub via_shell {
return $r;
}
-$testsub = \&via_shell;
-test '';
-test qq{a\n}, 'a';
-test qq{''\n}, '';
-test qq{foo 'bar baz' '*'\n}, 'foo', 'bar baz', '*';
+if ($^O eq 'MSWin32') {
+ print "ok # skip not working on MSWin32\n" x 4;
+} else {
+ $testsub = \&via_shell;
+ test '';
+ test qq{a\n}, 'a';
+ test qq{''\n}, '';
+ test qq{foo 'bar baz' '*'\n}, 'foo', 'bar baz', '*';
+}