]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commit
perf inject: Fix repipe usage
authorAdrian Hunter <adrian.hunter@intel.com>
Thu, 1 Apr 2021 10:36:05 +0000 (13:36 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 7 May 2021 07:53:40 +0000 (09:53 +0200)
commite194833773ef608402c24ad3314d6c463a8940ea
treef703ed462f7f540689eb2a1bae7211e09b767808
parent26949701933a6d63d105cf95424b665aecc48487
perf inject: Fix repipe usage

BugLink: https://bugs.launchpad.net/bugs/1926368
[ Upstream commit 026334a3bb6a3919b42aba9fc11843db2b77fd41 ]

Since commit 14d3d54052539a1e ("perf session: Try to read pipe data from
file") 'perf inject' has started printing "PERFILE2h" when not processing
pipes.

The commit exposed perf to the possiblity that the input is not a pipe
but the 'repipe' parameter gets used. That causes the printing because
perf inject sets 'repipe' to true always.

The 'repipe' parameter of perf_session__new() is used by 2 functions:

- perf_file_header__read_pipe()
- trace_report()

In both cases, the functions copy data to STDOUT_FILENO when 'repipe' is
true.

Fix by setting 'repipe' to true only if the output is a pipe.

Fixes: e558a5bd8b74aff4 ("perf inject: Work with files")
Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Cc: Andrew Vagin <avagin@openvz.org>
Link: http://lore.kernel.org/lkml/20210401103605.9000-1-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
tools/perf/builtin-inject.c