lkml.org 
[lkml]   [2022]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
Subject[PATCH] kbuild: fix build failure by scripts/check-local-export
From
scripts/check-local-export fails with some versions of bash.

CC scripts/mod/empty.o
./scripts/check-local-export: line 54: wait: pid 17328 is not a child of this shell
make[2]: *** [scripts/mod/empty.o] Error 127
make[2]: *** Deleting file `scripts/mod/empty.o'
make[1]: *** [prepare0] Error 2
make: *** [__sub-make] Error 2

Avoid use of bash's built-in wait command, by saving the output from
nm command into a temporary variable.

Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
Fixes: 31cb50b5590fe911 ("kbuild: check static EXPORT_SYMBOL* by script instead of modpost")
---
scripts/check-local-export | 29 +++++++++++++----------------
1 file changed, 13 insertions(+), 16 deletions(-)

diff --git a/scripts/check-local-export b/scripts/check-local-export
index da745e2743b7..5e46bc37a635 100755
--- a/scripts/check-local-export
+++ b/scripts/check-local-export
@@ -11,9 +11,20 @@ set -e
declare -A symbol_types
declare -a export_symbols

+function die
+{
+ echo "$1" >&2
+ exit 1
+}
+
exit_code=0

-while read value type name
+# If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm)
+# shows 'no symbols' diagnostic and exits with 0. Saving such line into
+# symbol_types is fine because export_symbols will remain empty.
+result=$(${NM} -- ${1} 2>&1) || die "${result}"
+
+echo "${result}" | while read value type name
do
# Skip the line if the number of fields is less than 3.
#
@@ -37,21 +48,7 @@ do
if [[ ${name} == __ksymtab_* ]]; then
export_symbols+=(${name#__ksymtab_})
fi
-
- # If there is no symbol in the object, ${NM} (both GNU nm and llvm-nm)
- # shows 'no symbols' diagnostic (but exits with 0). It is harmless and
- # hidden by '2>/dev/null'. However, it suppresses real error messages
- # as well. Add a hand-crafted error message here.
- #
- # Use --quiet instead of 2>/dev/null when we upgrade the minimum version
- # of binutils to 2.37, llvm to 13.0.0.
- #
- # Then, the following line will be really simple:
- # done < <(${NM} --quiet ${1})
-done < <(${NM} ${1} 2>/dev/null || { echo "${0}: ${NM} failed" >&2; false; } )
-
-# Catch error in the process substitution
-wait $!
+done

for name in "${export_symbols[@]}"
do
--
2.18.4
\
 
 \ /
  Last update: 2022-06-06 17:29    [W:0.118 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site