Hey Vladimir,

This is a bug in the way that DTrace composes arguments to the command
it executes as a result of the -c option.

http://src.illumos.org/source/xref/illumos-gate/usr/src/cmd/dtrace/dtrace.c#274

You can see that make_argv() just tokenizes the string based on
whitespace -- it doesn't use the tokenizing logic that the shell would
use. dtrace(1M) should probably do something like libast`sfnew() of
the command string, followed by an libshell`sh_parse() and
libshell`sh_exec() -- i.e. we want dtrace -c to act like sh -c.

I've filed this bug to track the issue:

  https://www.illumos.org/issues/1440

To work around this, you can probably create a shell script that
simply does an exec of the command you want to run with the arguments
you want.

Adam

On Thu, Sep 1, 2011 at 1:00 PM, Vladimir Kotal
<vladimir.ko...@oracle.com> wrote:
>
> Hi all,
>
> Sorry for a beginner's question but I can't find the answer anywhere and do
> not have time to investigate so I decided to exploit this forum. Is there a
> way how to instrument a command which has arguments containing whitespace
> with PID provider ?
>
> I am doing something like this:
>
> dtrace -Z -n 'pid$target::myfunc:return/arg1 == 1/ { ustack(); }' -c
> "/usr/bin/mycmd -a \"foo bar\" -b another"
>
> but everything I tried lead to usage printed by the command or dtrace(1) for
> one reason or another.
>
> Thanks for the answers,
>
>
> v.
> _______________________________________________
> dtrace-discuss mailing list
> dtrace-discuss@opensolaris.org
>



-- 
Adam Leventhal, Delphix
http://dtrace.org/blogs/ahl

275 Middlefield Road, Suite 50
Menlo Park, CA 94025
http://www.delphix.com
_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to