From 72ec4daaa546c2b82ae7f02ffdec46bd48c9baec Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Tue, 18 Sep 2018 15:39:57 -0400 Subject: [PATCH] Bug 538994 - cdtdebug: argv parameters are wrapper by double-quotes - modify cdtdebug.sh to use arrays to gather up options and then to use "${options[@]}" in the final string so each option is properly quoted if necessary Change-Id: Id7fec3bb0a6804f2124f837e1171f386ae5801f8 --- .../scripts/cdtdebug.sh | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh index 1583013e8d4..9cc046d3ae1 100644 --- a/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh +++ b/debug/org.eclipse.cdt.debug.application/scripts/cdtdebug.sh @@ -47,7 +47,7 @@ exit_missing_arg=' echo $0": error: option [$1] requires an argument"; exit 1' # Parse command line. -options= +i=0 while test $# -gt 0 ; do case $1 in --help | -h ) @@ -56,20 +56,27 @@ while test $# -gt 0 ; do echo $0": error: -vmargs option is prohibited"; exit 1;; -e ) test $# = 1 && eval "$exit_missing_arg" - options="$options $1 $2" + options[i]="$1" + let "i+=1" + options[i]="$2" + let "i+=1" shift; shift; # Get all options after -e and protect them from being # processed by Eclipse as Eclipse options while test $# -gt 0; do - options="$options \"$1\"" + options[i]=$1 + let "i+=1" shift; done ;; -c | -r ) test $# = 1 && eval "$exit_missing_arg" - options="$options $1 $2" + options[i]="$1" + let "i+=1" + options[i]="$2" + let "i+=1" shift; shift ;; * ) - options="$options $1"; shift ;; + options[i]="$1"; let "i+=1"; shift ;; esac done @@ -93,6 +100,6 @@ OSGI_JAR=`find "$PLUGIN_DIR" -maxdepth 1 -name 'org.eclipse.osgi_*.jar' -not -na # Run eclipse with the Stand-alone Debugger product specified "$ECLIPSE_EXEC" -clean -product org.eclipse.cdt.debug.application.product \ -data "$HOME/workspace-cdtdebug" -configuration file\:"$HOME/cdtdebugger" \ - -dev file\:"$HOME/cdtdebugger/dev.properties" $options \ + -dev file\:"$HOME/cdtdebugger/dev.properties" "${options[@]}" \ -vmargs -Dosgi.jar=$OSGI_JAR -Declipse.home="$ECLIPSE_HOME"