Skip to content
Commit db931285 authored by Miguel Ojeda's avatar Miguel Ojeda Committed by Greg Kroah-Hartman
Browse files

kheaders: use `command -v` to test for existence of `cpio`

[ Upstream commit 6e58e017 ]

Commit 13e1df09 ("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 9cc1df42 ("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: 13e1df09

 ("kheaders: explicitly validate existence of cpio command")
Signed-off-by: default avatarMiguel Ojeda <ojeda@kernel.org>
Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 0b01a41e
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment