[PATCH trace-cmd] trace-cmd report: Ensure filter is applied to single input file

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

 



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.

This was only lightly tested, using a single trace file.

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@xxxxxxx>
---
 tracecmd/trace-read.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/tracecmd/trace-read.c b/tracecmd/trace-read.c
index 52ba818..dbbd124 100644
--- a/tracecmd/trace-read.c
+++ b/tracecmd/trace-read.c
@@ -567,11 +567,15 @@ static void process_filters(struct handle_list *handles)
 	struct tracecmd_filter *trace_filter;
 	struct filter_str *filter;
 	int filters = 0;
+	struct input_files *input_file = handles->input_file;
 
-	make_pid_filter(handles->handle, handles->input_file);
+	if (!input_file)
+		input_file = last_input_file;
 
-	if (handles->input_file)
-		filter = handles->input_file->filter_str;
+	make_pid_filter(handles->handle, input_file);
+
+	if (input_file)
+		filter = input_file->filter_str;
 	else
 		filter = filter_strings;
 
-- 
2.35.3




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

  Powered by Linux