Re: [PATCH v2] kbuild: fix build failure by scripts/check-local-export
From: Tetsuo Handa
Date: Tue Jun 07 2022 - 06:11:57 EST
On 2022/06/07 17:34, Masahiro Yamada wrote:
> This patch does not work because you did not avoid
> running the while-loop in a subshell.
>
> It is well described in this page:
> https://riptutorial.com/bash/example/26955/to-avoid-usage-of-a-sub-shell
>
I didn't know that. Then, adding below diff will work.
@@ -24,7 +24,7 @@ exit_code=0
# symbol_types is fine because export_symbols will remain empty.
result=$(${NM} ${1} 2>&1) || die "${result}"
-echo "${result}" | while read value type name
+while read value type name
do
# Skip the line if the number of fields is less than 3.
#
@@ -48,7 +48,9 @@ do
if [[ ${name} == __ksymtab_* ]]; then
export_symbols+=(${name#__ksymtab_})
fi
-done
+done <<EOF
+"${result}"
+EOF
for name in "${export_symbols[@]}"
do
>
>
> I will send a working patch with a proper commit log.
OK. "[PATCH] scripts/check-local-export: avoid 'wait $!' for process substitution" works.
Thank you.