Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH stable 7.0] perf build: fix "argument list too long" in second location
@ 2026-05-13 23:46 Florian Fainelli
  2026-05-14 11:44 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: Florian Fainelli @ 2026-05-13 23:46 UTC (permalink / raw)
  To: stable
  Cc: Markus Mayer, James Clark, Namhyung Kim, Florian Fainelli,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Mark Rutland, Alexander Shishkin, Jiri Olsa, Ian Rogers,
	Adrian Hunter, open list:PERFORMANCE EVENTS SUBSYSTEM,
	open list:PERFORMANCE EVENTS SUBSYSTEM

From: Markus Mayer <mmayer@broadcom.com>

commit 97ab89686a9e5d087042dbe73604a32b3de72653 upstream

Turns out that displaying "RM $^" via quiet_cmd_rm can also upset the
shell and cause it to display "argument list too long".

Trying to quote $^ doesn't help.

In the end, *not* displaying the (potentially long) list of files is
probably the right thing to do for a "quiet" message, anyway. Instead,
let's display a count of how many files were removed. There is always
V=1 if more detail is required.

  TEST    linux/tools/perf/pmu-events/metric_test.log
  RM      ...634 orphan file(s)...
  LD      linux/tools/perf/util/perf-util-in.o

Also move the comment regarding xargs before the rule, so it doesn't
show up in the build output.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
Reviewed-by: James Clark <james.clark@linaro.org>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
 tools/perf/pmu-events/Build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
index dc5f94862a3b..dc1df2d57ddc 100644
--- a/tools/perf/pmu-events/Build
+++ b/tools/perf/pmu-events/Build
@@ -211,10 +211,10 @@ ifneq ($(strip $(ORPHAN_FILES)),)
 
 # Message for $(call echo-cmd,rm). Generally cleaning files isn't part
 # of a build step.
-quiet_cmd_rm  = RM      $^
+quiet_cmd_rm = RM      ...$(words $^) orphan file(s)...
 
+# The list of files can be long. Use xargs to prevent issues.
 prune_orphans: $(ORPHAN_FILES)
-	# The list of files can be long. Use xargs to prevent issues.
 	$(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f
 
 JEVENTS_DEPS += prune_orphans
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH stable 7.0] perf build: fix "argument list too long" in second location
  2026-05-13 23:46 [PATCH stable 7.0] perf build: fix "argument list too long" in second location Florian Fainelli
@ 2026-05-14 11:44 ` sashiko-bot
  0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-05-14 11:44 UTC (permalink / raw)
  To: Florian Fainelli; +Cc: linux-perf-users

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The fix for the 'Argument list too long' build error is incomplete. It reduces the shell command length by removing the file list from the 'RM' output, but still embeds the full file list via `echo "$^"` within the shell command executed by Make. This means the build will still fail with the exact same E2BIG error if the number of files increases further or if the build directory has a long absolute path.
--

commit 3997e5cf292c966edf5b226f773ec398849158ff
Author: Markus Mayer <mmayer@broadcom.com>

perf build: fix "argument list too long" in second location

This commit addresses an "argument list too long" build error by replacing
the explicit file list in quiet_cmd_rm with a file count. It also moves a
comment about xargs above the rule.

> diff --git a/tools/perf/pmu-events/Build b/tools/perf/pmu-events/Build
> index dc5f94862a3bc..dc1df2d57ddc1 100644
> --- a/tools/perf/pmu-events/Build
> +++ b/tools/perf/pmu-events/Build
> @@ -211,10 +211,10 @@ ifneq ($(strip $(ORPHAN_FILES)),)
>  
>  # Message for $(call echo-cmd,rm). Generally cleaning files isn't part
>  # of a build step.
> -quiet_cmd_rm  = RM      $^
> +quiet_cmd_rm = RM      ...$(words $^) orphan file(s)...
>  
> +# The list of files can be long. Use xargs to prevent issues.
>  prune_orphans: $(ORPHAN_FILES)
> -	# The list of files can be long. Use xargs to prevent issues.
>  	$(Q)$(call echo-cmd,rm)echo "$^" | xargs rm -f

Is the fix for the argument list too long error complete here?

When Make executes a recipe containing shell operators (like |), it spawns
/bin/sh -c "<recipe>". The entire recipe string is passed as argv[2] to
the shell, which is subject to the Linux MAX_ARG_STRLEN limit.

By removing $^ from quiet_cmd_rm, this change reduces the size of the
recipe string, which might temporarily drop it below the limit for the
current number of files.

However, echo "$^" | xargs rm -f still embeds the full file list directly
into the shell argument. If the path lengths or file count grow further,
couldn't this still exceed MAX_ARG_STRLEN and break the build?

Would it be more robust to bypass the shell argument limits entirely, for
instance by using Make's $(file ...) function to write the list directly
to a file?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260513234639.128528-1-florian.fainelli@broadcom.com?part=1

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-05-14 11:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-13 23:46 [PATCH stable 7.0] perf build: fix "argument list too long" in second location Florian Fainelli
2026-05-14 11:44 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox