Skip to content

Commit b6712d9

Browse files
Markus Mayeracmel
authored andcommitted
perf build: Prevent "argument list too long" error
Due to a recent change, building perf may result in a build error when it is trying to "prune orphans". The file list passed to "rm" may exceed what the shell can handle. The build will then abort with an error like this: TEST [...]/arm64/build/linux-custom/tools/perf/pmu-events/metric_test.log make[5]: /bin/sh: Argument list too long make[5]: *** [pmu-events/Build:217: prune_orphans] Error 127 make[5]: *** Waiting for unfinished jobs.... make[4]: *** [Makefile.perf:773: [...]/tools/perf/pmu-events/pmu-events-in.o] Error 2 make[4]: *** Waiting for unfinished jobs.... make[3]: *** [Makefile.perf:289: sub-make] Error 2 Processing the arguments via "xargs", instead of passing the list of files directly to "rm" via the shell, prevents this issue. Fixes: 36a1b00 ("perf build: Reduce pmu-events related copying and mkdirs") Reviewed-by: Ian Rogers <irogers@google.com> Signed-off-by: Markus Mayer <mmayer@broadcom.com> Cc: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: James Clark <james.clark@linaro.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent f079ff3 commit b6712d9

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • tools/perf/pmu-events

tools/perf/pmu-events/Build

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ ifneq ($(strip $(ORPHAN_FILES)),)
214214
quiet_cmd_rm = RM $^
215215

216216
prune_orphans: $(ORPHAN_FILES)
217-
$(Q)$(call echo-cmd,rm)rm -f $^
217+
# The list of files can be long. Use xargs to prevent issues.
218+
$(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f
218219

219220
JEVENTS_DEPS += prune_orphans
220221
endif

0 commit comments

Comments
 (0)