Re: [PATCH v3] kbuild: document recursive dependency limitation / resolution

From: Valentin Rothberg
Date: Tue Oct 06 2015 - 05:22:39 EST


Hi Paul,

On Oct 06 '15 10:32, Paul Bolle wrote:
> Hi Valentin,
>
> On di, 2015-10-06 at 10:19 +0200, Valentin Rothberg wrote:
> > I think that a general remark that using selects should be discouraged
> > as, besides causing the recursive issue, selects can also break
> > dependencies.
>
> How do selects break dependencies?

Consider the following example (I also attached it as a path):

config A
bool "CONFIG A"

config B
bool "CONFIG B"
depends on !A

config C
bool "CONFIG C"
depends on A
select B

The option B and C are clearly contradicting with respect to A.
However, when A is set, C can be set as well because Kconfig does not
visit the dependencies of the select target (in this case B). And since
Kconfig does not visit the dependencies, it breaks the dependencies of B
(!A).

You can test the example after applying the patch via:
$ make KBUILD_KCONFIG=bad_selects.Kconfig menuconfig

Set A, then set C and you'll see that B is set to 'y' as well.

Kind regards,
Valentin
diff --git a/bad_selects.Kconfig b/bad_selects.Kconfig
new file mode 100644
index 000000000000..989fc4e1fc17
--- /dev/null
+++ b/bad_selects.Kconfig
@@ -0,0 +1,11 @@
+config A
+ bool "CONFIG A"
+
+config B
+ bool "CONFIG B"
+ depends on !A
+
+config C
+ bool "CONFIG C"
+ depends on A
+ select B