* [ltt-dev] [PATCH] usttrace: allow spaces in command-line arguments
@ 2011-11-16 10:00 Stefan Hajnoczi
2011-11-16 12:17 ` Mathieu Desnoyers
0 siblings, 1 reply; 2+ messages in thread
From: Stefan Hajnoczi @ 2011-11-16 10:00 UTC (permalink / raw)
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 at linux.vnet.ibm.com>
---
usttrace | 7 ++-----
1 files changed, 2 insertions(+), 5 deletions(-)
diff --git a/usttrace b/usttrace
index e76dae7..d1a6e5f 100755
--- 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
--
1.7.7.1
^ permalink raw reply [flat|nested] 2+ messages in thread* [ltt-dev] [PATCH] usttrace: allow spaces in command-line arguments
2011-11-16 10:00 [ltt-dev] [PATCH] usttrace: allow spaces in command-line arguments Stefan Hajnoczi
@ 2011-11-16 12:17 ` Mathieu Desnoyers
0 siblings, 0 replies; 2+ messages in thread
From: Mathieu Desnoyers @ 2011-11-16 12:17 UTC (permalink / raw)
* Stefan Hajnoczi (stefanha at linux.vnet.ibm.com) wrote:
> 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.
Merged into UST 0.x.
Thanks,
Mathieu
>
> Signed-off-by: Stefan Hajnoczi <stefanha at linux.vnet.ibm.com>
> ---
> usttrace | 7 ++-----
> 1 files changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/usttrace b/usttrace
> index e76dae7..d1a6e5f 100755
> --- 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
> --
> 1.7.7.1
>
>
> _______________________________________________
> ltt-dev mailing list
> ltt-dev at lists.casi.polymtl.ca
> http://lists.casi.polymtl.ca/cgi-bin/mailman/listinfo/ltt-dev
>
--
Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.
http://www.efficios.com
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-11-16 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-16 10:00 [ltt-dev] [PATCH] usttrace: allow spaces in command-line arguments Stefan Hajnoczi
2011-11-16 12:17 ` Mathieu Desnoyers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox