lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK7LNAQmV=CGzEyJtBRSfz+YW6yTfWza7mf1dPXEiaJDT7z5xQ@mail.gmail.com>
Date: Wed, 6 Nov 2024 08:33:13 +0900
From: Masahiro Yamada <masahiroy@...nel.org>
To: David Hunter <david.hunter.linux@...il.com>
Cc: linux-kbuild@...r.kernel.org, linux-kernel@...r.kernel.org, 
	shuah@...nel.org, javier.carrasco.cruz@...il.com, 
	Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH v2 5/7] streamline_config.pl: fix: implement choice for kconfigs

On Mon, Oct 14, 2024 at 11:14 PM David Hunter
<david.hunter.linux@...il.com> wrote:
>
> Properly implement the config entries that are within the choice keyword
> for kconfig. Currently, the script only stops the previous config entry
> when a choice keyword is encountered.
>
> When the keyword "choice" is encountered, do the following:
>         - distribute the lines immediately following the "choice"
>           keyword to each config entry inside the "choice" section.
>         - process the config entries with the distributed lines.
>
> Signed-off-by: David Hunter <david.hunter.linux@...il.com>
> ---
> V1 https://lore.kernel.org/all/20240913171205.22126-6-david.hunter.linux@gmail.com/
>
> V2
>         - changed the subject prefix
>         - changed the method for storing and distributing the choice
>           block. No longer using temp file.
> ---
>  scripts/kconfig/streamline_config.pl | 47 ++++++++++++++++++++++++++--
>  1 file changed, 45 insertions(+), 2 deletions(-)
>
> diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl
> index b7ed79c5e070..4149c4b344db 100755
> --- a/scripts/kconfig/streamline_config.pl
> +++ b/scripts/kconfig/streamline_config.pl
> @@ -149,6 +149,34 @@ my $var;
>  my $iflevel = 0;
>  my @ifdeps;
>
> +# distributes choice entries to different config options
> +sub set_hash_value {
> +    my %htable = %{$_[0]};
> +    my $tmp_config = $_[1];
> +    my $current_config = $_[2];
> +    if (defined($htable{$tmp_config})) {
> +       ${$_[0]}{$current_config} = $htable{$tmp_config};
> +    }
> +}
> +
> +# distribute choice config entries
> +sub copy_configs {
> +    my $tmp_config = "TMP_CONFIG";
> +    my $choice_config = $_[0];
> +    set_hash_value (\%depends, $tmp_config, $choice_config);
> +    set_hash_value (\%selects, $tmp_config, $choice_config);
> +    set_hash_value (\%prompts, $tmp_config, $choice_config);
> +    set_hash_value (\%defaults, $tmp_config, $choice_config);
> +}
> +
> +sub delete_temp_config {
> +    my $tmp_config = "TMP_CONFIG";
> +    $depends{$tmp_config} = undef;
> +    $selects{$tmp_config} = undef;
> +    $prompts{$tmp_config} = undef;
> +    $defaults{$tmp_config} = undef;
> +}
> +


I previously suggested checking how the 'if' statement is handled.
https://lore.kernel.org/lkml/CAK7LNAQ8D4OVT81iTVs8jjrBXX6Zgwc+VJ_vb7hb4J-vCZZN=g@mail.gmail.com/


These two behave in a similar way
regarding the dependency propagation.


if FOO
config A
           bool "A"

config B
           bool "B"
endif



choice
         prompt "choose"
         depends on FOO
config A
           bool "A"
config B
           bool "B"
endchoice


The inner A and B inherit the dependency on FOO.

I attached a completely-untested patch.
I think 'if' and 'choice' can share the code.


BTW, 'menu' also can have 'depends on'.


menu "menu"
         depends on FOO
config A
           bool "A"
config B
           bool "B"
endmenu


This is not implemented, either.

I am not sure how much effort should be invested in this script, though.


-- 
Best Regards
Masahiro Yamada

View attachment "choice.diff" of type "text/x-patch" (1729 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ