Skip to content

Commit 6e58e01

Browse files
ojedamasahir0y
authored andcommitted
kheaders: use command -v to test for existence of cpio
Commit 13e1df0 ("kheaders: explicitly validate existence of cpio command") added an explicit check for `cpio` using `type`. However, `type` in `dash` (which is used in some popular distributions and base images as the shell script runner) prints the missing message to standard output, and thus no error is printed: $ bash -c 'type missing >/dev/null' bash: line 1: type: missing: not found $ dash -c 'type missing >/dev/null' $ For instance, this issue may be seen by loongarch builders, given its defconfig enables CONFIG_IKHEADERS since commit 9cc1df4 ("LoongArch: Update Loongson-3 default config file"). Therefore, use `command -v` instead to have consistent behavior, and take the chance to provide a more explicit error. Fixes: 13e1df0 ("kheaders: explicitly validate existence of cpio command") Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
1 parent 3bd27a8 commit 6e58e01

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

kernel/gen_kheaders.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ include/
1414
arch/$SRCARCH/include/
1515
"
1616

17-
type cpio > /dev/null
17+
if ! command -v cpio >/dev/null; then
18+
echo >&2 "***"
19+
echo >&2 "*** 'cpio' could not be found."
20+
echo >&2 "***"
21+
exit 1
22+
fi
1823

1924
# Support incremental builds by skipping archive generation
2025
# if timestamps of files being archived are not changed.

0 commit comments

Comments
 (0)