This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] enhance quoting for command string


On Wed, 2007-08-15 at 21:45 -0400, Frank Ch. Eigler wrote:
> Lai Jiangshan <laijs@cn.fujitsu.com> writes:
> 
> > [...]
> > When I was using systemtap to test the following command,
> > I found that it didn't work as expected.
> > $ stap -vv -c 'echo "Hello World"' -e "probe begin{}"
> 
> Yeah, not surprising: see bug #2424.
> 
> > [...] So I enhanced it by adding a function cmdstr_quoted() in
> > util.cxx. [...]
> 
> Yes, that could be one way.  staprun/stapio would have to do similar
> quoting to ensure that the funny strings make it all the way through.

If the string is quoted correctly why would it need requoted? It seems
to be working fine with this patch.

> (There's also the tapset function system() to worry about.)
Which is a completely different problem because the command line must be
passed in as a string in systemtap.  However it seems to always do
exactly what I expect.  Have you found any problems with it?

> For another way, we could explore using plain old exec*(2) instead of
> system(3) for invoking staprun/stapio/user-specified commands.

That's what I had in mind when I created 2424, however I reconsidered.
I find I like doing sequences of commands, like
stap -c "ls; ps" foo.stp
Not a useful example, but it works fine using system().

This patch seems to correct the quoting problem for all the testcases I
had. Any objections to committing it?

Martin




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]