When a symbol is double defined but with different prompts, where the active prompt is depending on a common setting both prompts may show.
For example to indicate to users that a given setting is EXPERIMENTAL under some circumstances, one prompt is shown when FOO is enabled also, and the other prompt is shown when FOO is disabled.
This happens when configs right below the second symbol is guarded (depends on) with an if.
Code that reproduces this:
config FOO
bool "FOO"
default n
bool
config BAR
bool "bar" if !FOO
config BAR
bool "bar [EXPERIMENTAL]" if FOO
if BAR
config BAZ
bool "Baz is here"
endif
As expected
Unexpected, both prompts are now shown:
Expected behavior
Only a sing prompt should be shown when FOO=n and BAR=y
Workaround
Add a DUMMY config between the last config and the if, like this:
config FOO
bool "FOO"
config BAR
bool "bar" if !FOO
config BAR
bool "bar [EXPERIMENTAL]" if FOO
config DUMMY
bool
if BAR
config BAZ
bool "Baz is here"
endif
Almost as before:
Now working as expected:
Cons on the workaround
BAZ setting is no longer indented as it is no longer seen as a submenu to BAR.
Problem description
When a symbol is double defined but with different prompts, where the active prompt is depending on a common setting both prompts may show. For example to indicate to users that a given setting is
EXPERIMENTAL
under some circumstances, one prompt is shown whenFOO
is enabled also, and the other prompt is shown whenFOO
is disabled.This happens when configs right below the second symbol is guarded (
depends on
) with anif
.Code that reproduces this:
As expected![image](https://user-images.githubusercontent.com/9802583/154456352-de381d3d-4d79-48a4-bc00-c10399aa7143.png)
Unexpected, both prompts are now shown:![image](https://user-images.githubusercontent.com/9802583/154456498-734ffb66-b90a-4e54-9c0f-1bede8dac1f4.png)
Expected behavior
Only a sing prompt should be shown when
FOO=n
andBAR=y
Workaround
Add a
DUMMY
config between the lastconfig
and theif
, like this:Almost as before:![image](https://user-images.githubusercontent.com/9802583/154456953-5bf7336d-86d6-4624-ab47-3534b3408184.png)
Now working as expected:![image](https://user-images.githubusercontent.com/9802583/154457321-7994b5d5-c009-4ce1-8727-f0949106bb7e.png)
Cons on the workaround
BAZ
setting is no longer indented as it is no longer seen as a submenu toBAR
.Additional info
This code is believed to be responsible for the observed behavior: https://github.com/ulfalizer/Kconfiglib/blob/061e71f7d78cb057762d88de088055361863deff/menuconfig.py#L1504-L1513