Re: [PATCH] kernel-shark: Provide parsing for quotation marks in Record command line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 27 Aug 2019 22:10:18 -0700
stephen@xxxxxxxxxx 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.

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




[Index of Archives]     [Linux USB Development]     [Linux USB Development]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux