diff options
author | Michael Forney <mforney@mforney.org> | 2018-08-16 03:13:50 +0300 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2018-08-22 17:21:40 +0300 |
commit | b5f8cb9e908f46feaa5d0ddbf3e2e1b8d85d1a65 (patch) | |
tree | 4df230f7f4489495f289af7bfcda7c07ff140272 /scripts/clang-version.sh | |
parent | 1f3aa9002dc6a0d59a4b599b4fc8f01cf43ef014 (diff) | |
download | linux-b5f8cb9e908f46feaa5d0ddbf3e2e1b8d85d1a65.tar.xz |
kbuild: Add a space after `!` to prevent parsing as file pattern
Some shells use !(pattern|...|pattern) to match file names not
containing the specified patterns. This may result in output like
$ ./scripts/clang-version.sh gcc
./scripts/clang-version.sh[18]: COPYING: not found
printf: %d __clang_major__: conversion error
printf: %d __clang_minor__: conversion error
printf: %d __clang_patchlevel__: conversion error
00000
$
and set CONFIG_CLANG_VERSION to the invalid value '00000'.
POSIX says[0]
If the pipeline begins with the reserved word ! and command1 is a
subshell command, the application shall ensure that the ( operator at
the beginning of command1 is separated from the ! by one or more
<blank> characters. The behavior of the reserved word ! immediately
followed by the ( operator is unspecified.
So, just add a <blank> to prevent this.
[0] http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_09_02
Signed-off-by: Michael Forney <mforney@mforney.org>
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'scripts/clang-version.sh')
-rwxr-xr-x | scripts/clang-version.sh | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/clang-version.sh b/scripts/clang-version.sh index dbf0a31eb111..e65fbc3079d4 100755 --- a/scripts/clang-version.sh +++ b/scripts/clang-version.sh @@ -12,7 +12,7 @@ compiler="$*" -if !( $compiler --version | grep -q clang) ; then +if ! ( $compiler --version | grep -q clang) ; then echo 0 exit 1 fi |