Re: oldconfig loop infinitely with a hex/int config without valid default and a closed stdin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 29, 2023 at 12:23 AM Yoann Congal <yoann.congal@xxxxxxxx> wrote:
>
>
> Hi,
>
> While analyzing a Yocto bug[0] I think I've identified a problem in kconfig.
> The problem happens if you have a hex or int type config without a default value.
> Like this :
>   config TEST_KCONFIG
>         hex "Test kconfig"
>         # No default value
> ... and try to start oldconfig with a closed stdin (like we have in Yocto):
>   echo -n "" | make oldconfig
>
> When this happens, oldconfig prompts for the value of TEST_KCONFIG but stdin is closed it get the global default value : an empty string. This is not a valid hex/int value so it prompts again, hence the infinite loop.
>
> I'm having trouble pointing where the bug is exactly :
> * Should the global default value for hex/int be valid in their context? (like the minimal value of the range or 0/0x0)
> * Must all int/hex config provide a valid default value? (This is the case for hex config in the kernel). This would have to be documented somewhere (Some other KConfig implementation did [1])


Presumably, it is reasonable to require explicit 'default' for int/hex.

Most of the int/hex entries in Linux are already doing it.


> * Should all oldconfig/syncconfig/... exit with an error when trying to prompt on a closed stdin? (I might be able to send a patch for this one)

No.
I have seen multiple scripts piping the 'yes' command to Kconfig.
There is no reason to prohibit pipe or redirection.





I think the fastest fix is to send a patch to U-Boot
to add a default for CONFIG_DEBUG_UART_BASE
(and more patches if there are other similar cases).





>
> NB: I know of olddefconfig but in the case of U-boot, syncconfig is used at a later stage and the problem appears again.
>
> What do you think?
>
> Regards,
>
> [0]: https://bugzilla.yoctoproject.org/show_bug.cgi?id=14136
> [1]: https://docs.zephyrproject.org/1.14.0/guides/kconfig/index.html#redundant-defaults
> --
> Yoann Congal
> Smile ECS - Tech Expert



-- 
Best Regards
Masahiro Yamada




[Index of Archives]     [Linux&nblp;USB Development]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite Secrets]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux