Browse Source

Bug 58898: Ant fails to run when arguments contain double-quote character

Test with lots of args that break existing script
./ant --execdebug -Df='"' -Dx="'" "-Dx='" -Dz=\'\""'"
master
Jeffrey Adamson 9 years ago
parent
commit
568c3eeb96
1 changed files with 4 additions and 2 deletions
  1. +4
    -2
      src/script/ant

+ 4
- 2
src/script/ant View File

@@ -35,7 +35,8 @@ for arg in "$@" ; do
if [ my"$arg" = my"-h" -o my"$arg" = my"-help" ] ; then
show_help=true
fi
ant_exec_args="$ant_exec_args \"$arg\""
# wrap all arguments as "" strings, escape any internal back-slash or double-quote characters
ant_exec_args="$ant_exec_args \"$(printf '%s' "$arg" | sed -e 's@"\|\\@\\\0@g' )\""
fi
done

@@ -333,4 +334,5 @@ ant_exec_command="exec \"\$JAVACMD\" $ANT_OPTS -classpath \"\$LOCALCLASSPATH\" -
if $ant_exec_debug ; then
echo $ant_exec_command $ant_exec_args
fi
eval $ant_exec_command "$ant_exec_args"

eval $ant_exec_command $ant_exec_args

Loading…
Cancel
Save