Re: [PATCH v2] kbuild: fix build failure by scripts/check-local-export

From: Masahiro Yamada
Date: Tue Jun 07 2022 - 04:35:47 EST


On Tue, Jun 7, 2022 at 7:13 AM Tetsuo Handa
<penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>
> 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.


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 will send a working patch with a proper commit log.

The part "Saving such line into symbol_types is fine because export_symbols
will remain empty." seems OK with me.
(I was searching for an elegant solution for this, but
I could not come up with a better one.)






> Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Fixes: 31cb50b5590fe911 ("kbuild: check static EXPORT_SYMBOL* by script instead of modpost")
> ---









--
Best Regards

Masahiro Yamada