aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGabriel Krisman Bertazi <krisman@suse.de>2023-03-30 15:52:09 -0300
committerSteven Rostedt (Google) <rostedt@goodmis.org>2023-05-30 03:28:03 -0400
commit04ad2c60be68a739221209b8c5ca2e0d6ea2202a (patch)
tree95d1c8bfa294feba1879436556b29952bf867886
parentedf9424029cc4a05166100a5957fab6a13791880 (diff)
downloadtrace-cmd-04ad2c60be68a739221209b8c5ca2e0d6ea2202a.tar.gz
trace-cmd report: Ensure filter is applied to single input file
Since 955d05fc7aee ("trace-cmd report: Make filter arguments match their files"), the -F filtering is silently ignored when a trace file is provided with -i and the filter comes after -i . The reason is that the filter is now associated with input_files and not saved to the global list only in this case, but process_filters still only checks the global list when handles->input_file is not set. Avoid this by checking last_input_file first, which always contains a pointer to the correct filter in this case. Link: https://lore.kernel.org/linux-trace-devel/20230330185211.5604-2-krisman@suse.de Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=217038 Fixes: 955d05fc7aee ("trace-cmd report: Make filter arguments match their files") Signed-off-by: Gabriel krisman Bertazi <krisman@suse.de> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
-rw-r--r--tracecmd/trace-read.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index 52ba818e..6a872d7b 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -564,14 +564,15 @@ static void make_pid_filter(struct tracecmd_input *handle,
static void process_filters(struct handle_list *handles)
{
+ struct input_files *input_file = handles->input_file ?: last_input_file;
struct tracecmd_filter *trace_filter;
struct filter_str *filter;
int filters = 0;
- make_pid_filter(handles->handle, handles->input_file);
+ make_pid_filter(handles->handle, input_file);
- if (handles->input_file)
- filter = handles->input_file->filter_str;
+ if (input_file)
+ filter = input_file->filter_str;
else
filter = filter_strings;