Skip to content

Commit 556bed5

Browse files
committed
perf beauty: Don't use 'find ... -printf' as it isn't available in busybox
Namhyung reported: I'm seeing a build error on my Alpine linux image which uses busybox + musl libc: In file included from trace/beauty/arch_errno_names.c:1, from builtin-trace.c:899: /build/trace/beauty/generated/arch_errno_name_array.c: In function 'arch_syscalls__strerrno': /build/trace/beauty/generated/arch_errno_name_array.c:142:49: error: unused parameter 'arch' [-Werror=unused-parameter] 142 | const char *arch_syscalls__strerrno(const char *arch, int err) It looks like busybox find command doesn't have -printf option find: unrecognized: -printf , Yesterday 9:16 PM , BusyBox v1.36.1 (2023-07-27 17:12:24 UTC) multi-call binary. Usage: find [-HL] [PATH]... [OPTIONS] [ACTIONS] Search for files and perform actions on them. First failed action stops processing of current file. Defaults: PATH is current directory, action is '-print' So just remove it and pipe find's entry to a basename loop to produce the same result. Then use an alternative loop that relies on the shell to avoid needless forks and execs. The discussion about it generated the impetus to stop doing strcmps to find the right table at each errno to string translation but instead do this just once and then use a function pointer to the right arch specific table. Suggested-by: David Laight <[email protected]> Reported-by: Namhyung Kim <[email protected]> Cc: Adrian Hunter <[email protected]> Cc: Hendrik Brueckner <[email protected]> Cc: Ian Rogers <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Michael Petlan <[email protected]> Cc: Thomas Richter <[email protected]> Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 072b6ad commit 556bed5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tools/perf/trace/beauty/arch_errno_names.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,9 @@ EoHEADER
7676

7777
# Create list of architectures that have a specific errno.h.
7878
archlist=""
79-
for arch in $(find $toolsdir/arch -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | sort -r); do
79+
for f in $toolsdir/arch/*/include/uapi/asm/errno.h; do
80+
d=${f%/include/uapi/asm/errno.h}
81+
arch="${d##*/}"
8082
test -f $toolsdir/arch/$arch/include/uapi/asm/errno.h && archlist="$archlist $arch"
8183
done
8284

0 commit comments

Comments
 (0)