[lkml]   [2012]   [Dec]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Subjectkbuild: Invalid configuration generated for dependent choices by 'conf' but not by 'mconf', with reason

Consider the following Kconfig file:

config MODULES
def_bool y

tristate "C1"
config A
tristate "A"
config B
tristate "B"

bool "C2" if A
config C
bool "C"
config D
bool "D"

When this Kconfig file is used with a configuration file containing
just "CONFIG_A=y", conf generates the following invalid configuration:

# CONFIG_B is not set
# CONFIG_D is not set

mconf on the other hand generates the correct configuration:

# CONFIG_B is not set
# CONFIG_D is not set

To see this, compare the .config files generated by the following commands:

$ scripts/kconfig/conf --defconfig=bug_config bug_Kconfig

$ cp bug_config .config
$ scripts/kconfig/mconf bug_Kconfig

The root cause of the problem is the sym_calc_value(csym) call at the
end of conf_set_all_new_symbols(). Since the second 'choice' depends
on A, that call causes the value of A to be calculated. But this also
causes SYMBOL_VALID to be set on A, preventing it from being
reevaluated later when the configuration is written in conf_write().
This reevaluation is required to get the correct value since only by
then will the choice have SYMBOL_DEF_USER set on it (set in

Some possible fixes:
(1) Add another sym_clear_all_valid() call at the end of
conf_set_all_new_symbols(). This is kinda wasteful.
(2) Just randomize_choice_values() seems to actually need the
sym_calc_value(csym). It could probably be moved into that function,
perhaps doing the additional sym_clear_all_valid() there unless
there's something neater you could do.

It would probably be safer if someone more familiar with the
randomization stuff wrote the actual patch.

Linux version is 3.7.0-rc4, though this bug has likely been around a while.


 \ /
  Last update: 2012-12-06 01:41    [W:0.071 / U:11.820 seconds]
©2003-2017 Jasper Spaans. hosted at Digital OceanAdvertise on this site