Repository: ant
Updated Branches:
  refs/heads/master c43870d45 -> 46b13c31c


try to fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59321

suggested patch by Jeffrey Adamson


Project: http://git-wip-us.apache.org/repos/asf/ant/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant/commit/c2666b19
Tree: http://git-wip-us.apache.org/repos/asf/ant/tree/c2666b19
Diff: http://git-wip-us.apache.org/repos/asf/ant/diff/c2666b19

Branch: refs/heads/master
Commit: c2666b1996fe03247c294dcd084579dedd4f2417
Parents: 642a050
Author: Stefan Bodewig <[email protected]>
Authored: Sat Oct 8 15:43:15 2016 +0200
Committer: Stefan Bodewig <[email protected]>
Committed: Sat Oct 8 15:43:15 2016 +0200

----------------------------------------------------------------------
 src/script/ant | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ant/blob/c2666b19/src/script/ant
----------------------------------------------------------------------
diff --git a/src/script/ant b/src/script/ant
index 2276b7c..58e187c 100755
--- a/src/script/ant
+++ b/src/script/ant
@@ -35,8 +35,13 @@ for arg in "$@" ; do
     if [  my"$arg" = my"-h"  -o  my"$arg" = my"-help" ] ; then
       show_help=true
     fi
-    # wrap all arguments as "" strings, escape any internal back-slash, 
double-quote, $, or back-tick characters
-    ant_exec_args="$ant_exec_args \"$(printf '%s\n' "$arg" | sed -e 
's@\$\|`\|"\|\\@\\\0@g' )\""
+    # escape $, ", and \ characters by inserting a \ 
+    esc_arg=`echo "$arg" | sed -e 's@[$"\\]@\\\\\\\\\0@g' `
+    # escape ` by inserting a \ 
+    esc_arg=`echo "$esc_arg" | sed -e 's@\`@\\\\\`@g'`
+    # wrap escaped arg as a quoted argument
+    quoted_arg="\"$esc_arg\""
+    ant_exec_args="$ant_exec_args $quoted_arg"
   fi
 done
 

Reply via email to