Re: [PATCH] kconfig: tell the kconfig symbol of the restart reason

From: Masahiro Yamada
Date: Wed Jul 12 2023 - 11:36:19 EST


On Tue, Jul 4, 2023 at 2:52 PM Randy Dunlap <rdunlap@xxxxxxxxxxxxx> wrote:
>
> When running 'make oldconfig' or 'make olddefconfig' without waiting

olddefconfig is not interactive in the first place.

'make config', 'make oldconfig', 'make syncconfig' are affected.


> for prompts, it can be useful to know the restart reason so that it
> can be fixed manually.
>
> This is usually when the prompt value is a number or a string,
> i.e., something other than y/m/n.



I do not understand what you mean.

Please give me some examples to see why this is useful.


BTW, "due to symbol ..." is not the reason for the restart.
It shows the first CONFIG option shown after the restart.



>
> Signed-off-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
> Cc: Masahiro Yamada <masahiroy@xxxxxxxxxx>
> Cc: linux-kbuild@xxxxxxxxxxxxxxx
> ---
> Can the test for sym->name be omitted?

Not all symbols have a name.
For example, 'choice' may not have a name.

[test code]

choice
prompt "A or B"
depends on FOO

config A
bool "A"

config B
bool "B"

endchoice

config FOO
bool "foo"



If you omit, sym->name test,
"due to symbol: (null)" will be displayed.
Not a crash, but users will be misguided.




foo (FOO) [N/y/?] (NEW) y
*
* Restart config...
* due to symbol: (null)
*
*
* Linux/x86 6.5.0-rc1 Kernel Configuration
*
A or B
> 1. A (A) (NEW)
2. B (B) (NEW)












> scripts/kconfig/conf.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff -- a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
> --- a/scripts/kconfig/conf.c
> +++ b/scripts/kconfig/conf.c
> @@ -652,8 +652,12 @@ static void check_conf(struct menu *menu
> printf("-----\n");
> break;
> default:
> - if (!conf_cnt++)
> - printf("*\n* Restart config...\n*\n");
> + if (!conf_cnt++) {
> + printf("*\n* Restart config...\n");
> + if (sym->name)
> + printf("* due to symbol: %s\n", sym->name);
> + printf("*\n");
> + }
> rootEntry = menu_get_parent_menu(menu);
> conf(rootEntry);
> break;



--
Best Regards
Masahiro Yamada