linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Yordan Karadzhov (VMware)" <y.karadz@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>, stephen@brennan.io
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH] kernel-shark: Provide parsing for quotation marks in Record command line
Date: Wed, 28 Aug 2019 17:10:48 +0300	[thread overview]
Message-ID: <d86d746e-fe00-2d0c-5fef-4a7d1c09c245@gmail.com> (raw)
In-Reply-To: <20190828090614.1372a9a8@gandalf.local.home>



On 28.08.19 г. 16:06 ч., Steven Rostedt wrote:
> On Tue, 27 Aug 2019 22:10:18 -0700
> stephen@brennan.io wrote:
> 
>> It strikes me that this explicitly supports only a single set of quotes.
>> This sort of behavior would be pretty surprising for people expecting shell
>> quote support, and for people expecting just splitting on spaces.
>>
>> I looked and couldn't really find any Qt utility for properly parsing shell
>> quoting (similar to python's shlex module). I totally get that it's a lot
>> of work to implement a correct shell quoting parser.
>>
>> Maybe a compromise would be to add a checkbox to the capture dialog, which
>> tells kernel-shark to pass the entire textbox contents, unmodified, to the
>> shell implementation on the system. So, my example of:
>>
>>      python -c 'print("hello world")'
>>
>> Would get put into the third argument of the command:
>>
>>      /bin/sh -c INSERT_TEXTBOX_CONTENTS_HERE
>>
>> Then you could rely on /bin/sh doing the parsing for you. The downside is
>> that it adds a whole new process. But you can't always get everything in
>> life, right?
>>
> 
> I need to look at this a bit deeper. I've written lots of cases where I
> had to capture single and double quotes and turn them into a single
> command. This is definitely needed here.
> 

Can you send me few of the of most trickier examples that comes to your 
mind, so that I can use them to test the parsing?

Thanks!
Yordan

> I'm very reluctant to just use a simple /bin/sh, as this is being run
> as root. Grant you, it is open to do anything, but I rather not just
> make it into a root shell. Although we still allow you to run any
> command. But once you add a full shell with the "sh -c" you now need to
> deal with environment variables and such, which can cause more
> unexpected side effects.
> 
> Basically, we want to be able to add single and double quotes, as well
> as backslashes: my -c 'command\'s here' and '\\' this "too"
> 
> Thanks for the feedback.
> 
> -- Steve
> 

  reply	other threads:[~2019-08-28 14:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-27 13:14 [PATCH] kernel-shark: Provide parsing for quotation marks in Record command line Yordan Karadzhov (VMware)
2019-08-28  5:10 ` stephen
2019-08-28 13:06   ` Steven Rostedt
2019-08-28 14:10     ` Yordan Karadzhov (VMware) [this message]
2019-08-28 14:56       ` Steven Rostedt
2019-08-28 13:25 ` Steven Rostedt
2019-08-28 13:30   ` Steven Rostedt
2019-09-17 10:44     ` Yordan Karadzhov (VMware)
2019-09-17 13:17       ` Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d86d746e-fe00-2d0c-5fef-4a7d1c09c245@gmail.com \
    --to=y.karadz@gmail.com \
    --cc=linux-trace-devel@vger.kernel.org \
    --cc=rostedt@goodmis.org \
    --cc=stephen@brennan.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).