Bug 204679

Summary: Shell escaping in kernel shark recorder
Product: Tools Reporter: Stephen Brennan (stephen)
Component: Trace-cmd/KernelsharkAssignee: Default virtual assignee for Trace-cmd and kernelshark (tools_tracecmd_kernelshark)
Status: RESOLVED CODE_FIX    
Severity: normal CC: ykaradzhov
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 5.2 (n/a) Subsystem:
Regression: No Bisected commit-id:
Attachments: quotation parsing patch

Description Stephen Brennan 2019-08-23 22:59:50 UTC
I tried to use kernel shark to record:

    python -c 'print("hello world")'

But I got the following (in the output textbox):

    trace-cmd record -e all -o /home/stephen/trace.dat python -c 'print("hello world")'
      File "<string>", line 1
        'print("hello
                    ^

Looks like kernel shark doesn't do the shell parsing (or ask sh to do it), and so the command got garbled. It would be nice if it could do this.
Comment 1 Steven Rostedt 2019-08-23 23:01:53 UTC
 I'm currently traveling and may be slow to respond. I'll be back at my normal
 hours on Monday, August 26th.

-- Steve
Comment 2 Stephen Brennan 2019-08-24 03:11:59 UTC
I suppose "shell escaping" was incorrect, and more accurately it would be "shell quoting".
Comment 3 Yordan Karadzhov 2019-08-27 13:16:13 UTC
Created attachment 284633 [details]
quotation parsing patch
Comment 4 Yordan Karadzhov 2019-08-27 13:20:44 UTC
Hi Stephen,

Thanks a lot for your report, and the interesting use-case that you bring!
A patch that implements a parsing (very primitive) of quoting is attached.

Cheers,
Yordan
Comment 5 Yordan Karadzhov 2019-10-10 08:09:20 UTC
Fixed by commit 9669fb0 (kernel-shark: Provide parsing for quotation marks in Record command line)