All of lore.kernel.org
 help / color / mirror / Atom feed
* [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config
@ 2019-04-24 12:02 Alexander Popov
  2019-04-24 15:02 ` Kees Cook
  2019-05-01 13:01 ` Alexander Popov
  0 siblings, 2 replies; 5+ messages in thread
From: Alexander Popov @ 2019-04-24 12:02 UTC (permalink / raw)
  To: Masahiro Yamada, Kees Cook, Michal Marek, linux-kbuild,
	linux-kernel, Alexander Popov

Currently menu blocks start with a pretty header but end with nothing in
the generated config. So next config options stick together with the
options from the menu block.

Let's terminate menu blocks in the generated config with a comment and
a newline if needed. Example:

...
CONFIG_BPF_STREAM_PARSER=y
CONFIG_NET_FLOW_LIMIT=y

#
# Network testing
#
CONFIG_NET_PKTGEN=y
CONFIG_NET_DROP_MONITOR=y
# end of Network testing
# end of Networking options

CONFIG_HAMRADIO=y
...

Signed-off-by: Alexander Popov <alex.popov@linux.com>
---
 scripts/kconfig/confdata.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 08ba146..486b4c7 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -819,6 +819,7 @@ int conf_write(const char *name)
 	struct menu *menu;
 	const char *basename;
 	const char *str;
+	bool need_newline = false;
 	char dirname[PATH_MAX+1], tmpname[PATH_MAX+22], newname[PATH_MAX+8];
 	char *env;
 
@@ -871,12 +872,16 @@ int conf_write(const char *name)
 				     "#\n"
 				     "# %s\n"
 				     "#\n", str);
+			need_newline = false;
 		} else if (!(sym->flags & SYMBOL_CHOICE)) {
 			sym_calc_value(sym);
 			if (!(sym->flags & SYMBOL_WRITE))
 				goto next;
+			if (need_newline) {
+				fprintf(out, "\n");
+				need_newline = false;
+			}
 			sym->flags &= ~SYMBOL_WRITE;
-
 			conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
 		}
 
@@ -888,6 +893,11 @@ int conf_write(const char *name)
 		if (menu->next)
 			menu = menu->next;
 		else while ((menu = menu->parent)) {
+			if (!menu->sym && menu_is_visible(menu)) {
+				str = menu_get_prompt(menu);
+				fprintf(out, "# end of %s\n", str);
+				need_newline = true;
+			}
 			if (menu->next) {
 				menu = menu->next;
 				break;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config
  2019-04-24 12:02 [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config Alexander Popov
@ 2019-04-24 15:02 ` Kees Cook
  2019-05-01 13:01 ` Alexander Popov
  1 sibling, 0 replies; 5+ messages in thread
From: Kees Cook @ 2019-04-24 15:02 UTC (permalink / raw)
  To: Alexander Popov; +Cc: Masahiro Yamada, Michal Marek, linux-kbuild, LKML

On Wed, Apr 24, 2019 at 5:03 AM Alexander Popov <alex.popov@linux.com> wrote:
>
> Currently menu blocks start with a pretty header but end with nothing in
> the generated config. So next config options stick together with the
> options from the menu block.
>
> Let's terminate menu blocks in the generated config with a comment and
> a newline if needed. Example:
>
> ...
> CONFIG_BPF_STREAM_PARSER=y
> CONFIG_NET_FLOW_LIMIT=y
>
> #
> # Network testing
> #
> CONFIG_NET_PKTGEN=y
> CONFIG_NET_DROP_MONITOR=y
> # end of Network testing
> # end of Networking options
>
> CONFIG_HAMRADIO=y
> ...
>
> Signed-off-by: Alexander Popov <alex.popov@linux.com>

Reviewed-by: Kees Cook <keescook@chromium.org>

-Kees

> ---
>  scripts/kconfig/confdata.c | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
> index 08ba146..486b4c7 100644
> --- a/scripts/kconfig/confdata.c
> +++ b/scripts/kconfig/confdata.c
> @@ -819,6 +819,7 @@ int conf_write(const char *name)
>         struct menu *menu;
>         const char *basename;
>         const char *str;
> +       bool need_newline = false;
>         char dirname[PATH_MAX+1], tmpname[PATH_MAX+22], newname[PATH_MAX+8];
>         char *env;
>
> @@ -871,12 +872,16 @@ int conf_write(const char *name)
>                                      "#\n"
>                                      "# %s\n"
>                                      "#\n", str);
> +                       need_newline = false;
>                 } else if (!(sym->flags & SYMBOL_CHOICE)) {
>                         sym_calc_value(sym);
>                         if (!(sym->flags & SYMBOL_WRITE))
>                                 goto next;
> +                       if (need_newline) {
> +                               fprintf(out, "\n");
> +                               need_newline = false;
> +                       }
>                         sym->flags &= ~SYMBOL_WRITE;
> -
>                         conf_write_symbol(out, sym, &kconfig_printer_cb, NULL);
>                 }
>
> @@ -888,6 +893,11 @@ int conf_write(const char *name)
>                 if (menu->next)
>                         menu = menu->next;
>                 else while ((menu = menu->parent)) {
> +                       if (!menu->sym && menu_is_visible(menu)) {
> +                               str = menu_get_prompt(menu);
> +                               fprintf(out, "# end of %s\n", str);
> +                               need_newline = true;
> +                       }
>                         if (menu->next) {
>                                 menu = menu->next;
>                                 break;
> --
> 2.7.4
>


-- 
Kees Cook

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config
  2019-04-24 12:02 [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config Alexander Popov
  2019-04-24 15:02 ` Kees Cook
@ 2019-05-01 13:01 ` Alexander Popov
  2019-05-07 12:29   ` Masahiro Yamada
  1 sibling, 1 reply; 5+ messages in thread
From: Alexander Popov @ 2019-05-01 13:01 UTC (permalink / raw)
  To: Masahiro Yamada, Kees Cook, Michal Marek, linux-kbuild, linux-kernel

On 24.04.2019 15:02, Alexander Popov wrote:
> Currently menu blocks start with a pretty header but end with nothing in
> the generated config. So next config options stick together with the
> options from the menu block.
> 
> Let's terminate menu blocks in the generated config with a comment and
> a newline if needed. Example:
> 
> ...
> CONFIG_BPF_STREAM_PARSER=y
> CONFIG_NET_FLOW_LIMIT=y
> 
> #
> # Network testing
> #
> CONFIG_NET_PKTGEN=y
> CONFIG_NET_DROP_MONITOR=y
> # end of Network testing
> # end of Networking options
> 
> CONFIG_HAMRADIO=y
> ...
> 
> Signed-off-by: Alexander Popov <alex.popov@linux.com>

Hello!

Just a friendly ping.

Would you like to take this patch?
Can I improve anything?

Best regards,
Alexander

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config
  2019-05-01 13:01 ` Alexander Popov
@ 2019-05-07 12:29   ` Masahiro Yamada
  2019-05-07 19:44     ` Alexander Popov
  0 siblings, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2019-05-07 12:29 UTC (permalink / raw)
  To: Alexander Popov
  Cc: Kees Cook, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List

On Wed, May 1, 2019 at 10:01 PM Alexander Popov <alex.popov@linux.com> wrote:
>
> On 24.04.2019 15:02, Alexander Popov wrote:
> > Currently menu blocks start with a pretty header but end with nothing in
> > the generated config. So next config options stick together with the
> > options from the menu block.
> >
> > Let's terminate menu blocks in the generated config with a comment and
> > a newline if needed. Example:
> >
> > ...
> > CONFIG_BPF_STREAM_PARSER=y
> > CONFIG_NET_FLOW_LIMIT=y
> >
> > #
> > # Network testing
> > #
> > CONFIG_NET_PKTGEN=y
> > CONFIG_NET_DROP_MONITOR=y
> > # end of Network testing
> > # end of Networking options
> >
> > CONFIG_HAMRADIO=y
> > ...
> >
> > Signed-off-by: Alexander Popov <alex.popov@linux.com>
>
> Hello!
>
> Just a friendly ping.
>
> Would you like to take this patch?
> Can I improve anything?


This patch breaks "make testconfig".

Please get rid of the "endof" for the rootmenu
at the end of the .config file.

Thanks.




> Best regards,
> Alexander



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config
  2019-05-07 12:29   ` Masahiro Yamada
@ 2019-05-07 19:44     ` Alexander Popov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexander Popov @ 2019-05-07 19:44 UTC (permalink / raw)
  To: Masahiro Yamada
  Cc: Kees Cook, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List



7 May 2019 15:29:26 GMT+03:00, Masahiro Yamada <yamada.masahiro@socionext.com> wrote:
>This patch breaks "make testconfig".
>
>Please get rid of the "endof" for the rootmenu
>at the end of the .config file.

Thanks a lot for having a look! 
I'll fix this issue, test it and return with the next version. 

Best regards, 
Alexander 

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-05-07 19:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 12:02 [v2 1/1] kconfig: Terminate menu blocks with a comment in the generated config Alexander Popov
2019-04-24 15:02 ` Kees Cook
2019-05-01 13:01 ` Alexander Popov
2019-05-07 12:29   ` Masahiro Yamada
2019-05-07 19:44     ` Alexander Popov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.