All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: linux-kbuild@vger.kernel.org, Michal Marek <mmarek@suse.cz>
Subject: randconfig bug when used with KCONFIG_ALLCONFIG
Date: Wed, 27 Feb 2013 21:41:02 +0100	[thread overview]
Message-ID: <20130227214102.6d63544d@skate> (raw)

Hello,

I'd like to report that the randconfig code seems to have a bug when it
is given a set of fixed values using KCONFIG_ALLCONFIG: it forgets to
randomize choice values.

Take the following Config.test.in:

-----8<----------8<------------8<----------
config OPTIONA
       bool "Option A"

choice
	prompt "This is a choice"

config CHOICE_OPTIONA
	bool "Choice Option A"

config CHOICE_OPTIONB
	bool "Choice Option B"

endchoice

config OPTIONB
       bool "Option B"
-----8<----------8<------------8<----------

If you do (using the kernel's kconfig):

 ./scripts/kconfig/conf --randconfig Config.test.in

you will see that the generated .config file properly randomizes all
options, including CHOICE_OPTIONA and CHOICE_OPTIONB.

Now, if we create a partial .config (named orig.config) file to set
the value of some options:

-----8<----------8<------------8<----------
CONFIG_OPTIONA=y
-----8<----------8<------------8<----------

If you do:

 KCONFIG_ALLCONFIG=orig.config ./scripts/kconfig/conf --randconfig Config.test.in

and look at the resulting .config, you will see that:

 * CONFIG_OPTIONA is always set to y, which is OK.

 * CONFIG_OPTIONB is properly randomized

 * But in the choice, it's always CONFIG_CHOICE_OPTIONA that will be
   selected, and never CONFIG_CHOICE_OPTIONB. The randomization for
   choices doesn't work as soon as a file is passed as
   KCONFIG_ALLCONFIG.

As you can see, the randomization of choices does not work properly
when KCONFIG_ALLCONFIG is used.

I've looked a little bit in the code, and in the following piece of
code from confdata.c:

	for_all_symbols(i, csym) {
		if (sym_has_value(csym) || !sym_is_choice(csym))
			continue;

		sym_calc_value(csym);
		if (mode == def_random)
			randomize_choice_values(csym);
		else
			set_all_choice_values(csym);
	}

which is normally responsible for randomizing choice values,
sym_has_value(csym) returns true for all choice options when
KCONFIG_ALLCONFIG is used, which explains why the choices are not
randomized. I haven't found out though why the kconfig code thinks that
all choice values already have a value, even though no value has been
passed through the KCONFIG_ALLCONFIG file.

Any hints? Or patch to test?

Thanks,

Thomas Petazzoni
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

             reply	other threads:[~2013-02-27 20:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-27 20:41 Thomas Petazzoni [this message]
2013-03-03 20:01 ` randconfig bug when used with KCONFIG_ALLCONFIG Thomas Petazzoni
2013-03-10 16:01 ` [PATCH] kconfig: do randomise choice entries in presence of KCONFIG_ALLCONFIG Yann E. MORIN
2013-03-11 21:40   ` Thomas Petazzoni
2013-03-13 18:27   ` Yann E. MORIN
2013-04-08 11:52   ` Yann E. MORIN
2013-04-09 12:02     ` Yann E. MORIN
2013-04-10 21:20 ` Yann E. MORIN
2013-04-11  9:44   ` Michal Marek
2013-04-11  9:58     ` Yann E. MORIN

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=20130227214102.6d63544d@skate \
    --to=thomas.petazzoni@free-electrons.com \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=mmarek@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.