usttrace: allow spaces in command-line arguments
authorStefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Wed, 16 Nov 2011 12:17:21 +0000 (07:17 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Wed, 16 Nov 2011 12:17:21 +0000 (07:17 -0500)
The usttrace uses $*, which expands arguments without preserving their
boundaries.  This causes arguments that include spaces to be mangled:

[0] "echo"
[1] "hello world"

becomes:

[0] "echo"
[1] "hello"
[2] "world"

Use "$@" instead so that argument boundaries are preserved.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
usttrace

index e76dae71be1f6590e1ea487bde1ba3c4921ddea3..d1a6e5fef71b1c3ee6db7c609557e8ae640a83ae 100755 (executable)
--- a/usttrace
+++ b/usttrace
@@ -85,16 +85,13 @@ if [ -n "$where" ]; then
        exit 0
 fi
 
-# Prepare vars
-CMD=$*
-
 # Validate input
 if [ -z "$HOME" ];
 then
        error "no home specified"
 fi
 
-if [ -z "$CMD" ];
+if [ -z "$*" ];
 then
        error "no command specified"
        usage;
@@ -196,7 +193,7 @@ fi
     fi
 
 # Execute the command
-    $CMD 2>&1
+    "$@" 2>&1
 ) | tee "$OUTDIR/app.log"
 
 ## Because of the keepalive mechanism, we're sure that by the time
This page took 0.023752 seconds and 4 git commands to generate.