linux-kbuild.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Masahiro Yamada <masahiroy@kernel.org>
To: Nathan Chancellor <nathan@kernel.org>
Cc: Yoann Congal <yoann.congal@smile.fr>,
	linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org,
	Randy Dunlap <rdunlap@infradead.org>,
	Brandon Maier <brandon.maier@collins.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	llvm@lists.linux.dev
Subject: Re: [PATCH v5] kconfig: avoid an infinite loop in oldconfig/syncconfig
Date: Thu, 9 Nov 2023 06:26:16 +0200	[thread overview]
Message-ID: <CAK7LNARpJ9huseh-Ro9v8W_tabMof9cuUZO43gi-hfEnXG4FYA@mail.gmail.com> (raw)
In-Reply-To: <20231107210004.GA2065849@dev-arch.thelio-3990X>

On Tue, Nov 7, 2023 at 11:00 PM Nathan Chancellor <nathan@kernel.org> wrote:
>
> On Sun, Nov 05, 2023 at 04:55:57PM +0900, Masahiro Yamada wrote:
> > On Sun, Nov 5, 2023 at 7:27 AM Yoann Congal <yoann.congal@smile.fr> wrote:
> > >
> > > Exit on error when asking for value and reading stdin returns an error
> > > (mainly if it has reached EOF or is closed).
> > >
> > > This infinite loop happens in particular for hex/int configs without an
> > > explicit default value.
> > >
> > > Previously, this case would loop:
> > > * oldconfig prompts for the value but stdin has reached EOF
> > > * It gets the global default value : an empty string
> > > * This is not a valid hex/int value so it prompts again, hence the
> > >   infinite loop.
> > >
> > > This case happens with a configuration like this (a hex config without a
> > > valid default value):
> > >   config TEST_KCONFIG
> > >        hex "Test KConfig"
> > >        # default 0x0
> > >
> > > And using:
> > >   make oldconfig < /dev/null
> > >
> > > This was discovered when working on Yocto bug[0] on a downstream
> > > kconfig user (U-boot)
> > >
> > > [0]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14136
> > >
> > > CC: Brandon Maier <brandon.maier@collins.com>
> > > Signed-off-by: Yoann Congal <yoann.congal@smile.fr>
> >
> > Applied to linux-kbuild.
> > Thanks.
>
> For what it's worth, this change breaks our continuous integration [1]
> because tuxmake explicitly uses /dev/null as stdin to make for
> non-interactive commands (I think it does this as basically the
> equivalent of "yes '' | make" in Python), so the error will always
> occur.
>
> Before:
>
> $ curl -LSso .config https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/main/config
>
> # Same as 'make < /dev/null' but still
> $ python3 -c "import subprocess; subprocess.run(['make', '-j128'], stdin=subprocess.DEVNULL)"
>   SYNC    include/config/auto.conf
>   HOSTCC  scripts/basic/fixdep
>   HOSTCC  scripts/kconfig/conf.o
>   HOSTCC  scripts/kconfig/confdata.o
>   HOSTCC  scripts/kconfig/expr.o
>   LEX     scripts/kconfig/lexer.lex.c
>   YACC    scripts/kconfig/parser.tab.[ch]
>   HOSTCC  scripts/kconfig/menu.o
>   HOSTCC  scripts/kconfig/preprocess.o
>   HOSTCC  scripts/kconfig/symbol.o
>   HOSTCC  scripts/kconfig/util.o
>   HOSTCC  scripts/kconfig/lexer.lex.o
>   HOSTCC  scripts/kconfig/parser.tab.o
>   HOSTLD  scripts/kconfig/conf
> *
> * Restart config...
> *
> ...
> Error in reading or end of file.
>
>   GEN     arch/x86/include/generated/asm/orc_hash.h
>   WRAP    arch/x86/include/generated/uapi/asm/bpf_perf_event.h
>   WRAP    arch/x86/include/generated/uapi/asm/errno.h
> ...
>
> After:
>
> $ curl -LSso .config https://gitlab.archlinux.org/archlinux/packaging/packages/linux/-/raw/main/config
>
> $ python3 -c "import subprocess; subprocess.run(['make', '-j128'], stdin=subprocess.DEVNULL)"
>   SYNC    include/config/auto.conf
>   HOSTCC  scripts/basic/fixdep
>   HOSTCC  scripts/kconfig/conf.o
>   HOSTCC  scripts/kconfig/confdata.o
>   HOSTCC  scripts/kconfig/expr.o
>   LEX     scripts/kconfig/lexer.lex.c
>   YACC    scripts/kconfig/parser.tab.[ch]
>   HOSTCC  scripts/kconfig/menu.o
>   HOSTCC  scripts/kconfig/preprocess.o
>   HOSTCC  scripts/kconfig/symbol.o
>   HOSTCC  scripts/kconfig/util.o
>   HOSTCC  scripts/kconfig/lexer.lex.o
>   HOSTCC  scripts/kconfig/parser.tab.o
>   HOSTLD  scripts/kconfig/conf
> *
> * Restart config...
> *
> ...
> Error in reading or end of file.
> make[3]: *** [scripts/kconfig/Makefile:77: syncconfig] Error 1
> ...
>
> We have been doing this for some time and never run across an infinite
> loop in syncconfig. Can this be improved?



In Linux, most int/hex entries have a default,
hence there is no practical issue.

I will drop this for now.

I will send an alternative solution.








--
Best Regards
Masahiro Yamada

  reply	other threads:[~2023-11-09  4:26 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-04 22:27 [PATCH v5] kconfig: avoid an infinite loop in oldconfig/syncconfig Yoann Congal
2023-11-05  7:55 ` Masahiro Yamada
2023-11-07 21:00   ` Nathan Chancellor
2023-11-09  4:26     ` Masahiro Yamada [this message]
2023-11-09 22:56       ` Yoann Congal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAK7LNARpJ9huseh-Ro9v8W_tabMof9cuUZO43gi-hfEnXG4FYA@mail.gmail.com \
    --to=masahiroy@kernel.org \
    --cc=brandon.maier@collins.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=nathan@kernel.org \
    --cc=ndesaulniers@google.com \
    --cc=rdunlap@infradead.org \
    --cc=yoann.congal@smile.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).