Hi,

Consider the following Kconfig file:

config MODULES
    def_bool y

choice
        tristate "C1"
config A
        tristate "A"
config B
        tristate "B"
endchoice

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

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

CONFIG_MODULES=y
CONFIG_A=m
# CONFIG_B is not set
CONFIG_C=y
# CONFIG_D is not set

mconf on the other hand generates the correct configuration:

CONFIG_MODULES=y
CONFIG_A=y
# CONFIG_B is not set
CONFIG_C=y
# 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
set_all_choice_values()).

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.

/Ulf
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to