From nobody Tue Apr 28 03:57:55 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9DD19C43334 for ; Mon, 6 Jun 2022 15:28:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240808AbiFFP24 (ORCPT ); Mon, 6 Jun 2022 11:28:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55140 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240714AbiFFP1O (ORCPT ); Mon, 6 Jun 2022 11:27:14 -0400 Received: from www262.sakura.ne.jp (www262.sakura.ne.jp [202.181.97.72]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 77BE813D for ; Mon, 6 Jun 2022 08:27:10 -0700 (PDT) Received: from fsav412.sakura.ne.jp (fsav412.sakura.ne.jp [133.242.250.111]) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTP id 256FQsii022668; Tue, 7 Jun 2022 00:26:54 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Received: from www262.sakura.ne.jp (202.181.97.72) by fsav412.sakura.ne.jp (F-Secure/fsigk_smtp/550/fsav412.sakura.ne.jp); Tue, 07 Jun 2022 00:26:54 +0900 (JST) X-Virus-Status: clean(F-Secure/fsigk_smtp/550/fsav412.sakura.ne.jp) Received: from [192.168.1.9] (M106072142033.v4.enabler.ne.jp [106.72.142.33]) (authenticated bits=0) by www262.sakura.ne.jp (8.15.2/8.15.2) with ESMTPSA id 256FQrta022664 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NO); Tue, 7 Jun 2022 00:26:54 +0900 (JST) (envelope-from penguin-kernel@I-love.SAKURA.ne.jp) Message-ID: Date: Tue, 7 Jun 2022 00:26:51 +0900 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Subject: [PATCH] kbuild: fix build failure by scripts/check-local-export Content-Language: en-US From: Tetsuo Handa To: Masahiro Yamada Cc: Nick Desaulniers , Nathan Chancellor , Sedat Dilek , LKML , Michael Ellerman References: <62ba96a2-0a0c-ab8e-351d-398f31a880ae@I-love.SAKURA.ne.jp> In-Reply-To: <62ba96a2-0a0c-ab8e-351d-398f31a880ae@I-love.SAKURA.ne.jp> Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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 Fixes: 31cb50b5590fe911 ("kbuild: check static EXPORT_SYMBOL* by script ins= tead of modpost") Reported-by: kernel test robot --- 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 =20 +function die +{ + echo "$1" >&2 + exit 1 +} + exit_code=3D0 =20 -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=3D$(${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} =3D=3D __ksymtab_* ]]; then export_symbols+=3D(${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 =20 for name in "${export_symbols[@]}" do --=20 2.18.4