From c2666b1996fe03247c294dcd084579dedd4f2417 Mon Sep 17 00:00:00 2001 From: Stefan Bodewig Date: Sat, 8 Oct 2016 15:43:15 +0200 Subject: [PATCH] try to fix https://bz.apache.org/bugzilla/show_bug.cgi?id=59321 suggested patch by Jeffrey Adamson --- src/script/ant | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/script/ant b/src/script/ant index 2276b7c00..58e187c65 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