linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* 2.6 bug: kconfig implementation doesn't match the spec
@ 2003-08-08 14:51 Adrian Bunk
  2003-08-08 15:16 ` Roman Zippel
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2003-08-08 14:51 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel

Hi Roman,

the implementation of the !-operator doesn't match the spec in
Documentation/kbuild/kconfig-language.txt

kconfig-language.txt says:

<--  snip  -->

...
           '!' <expr>                           (5)
...
(5) Returns the result of (2-/expr/).
...
An expression can have a value of 'n', 'm' or 'y' (or 0, 1, 2
respectively for calculations). A menu entry becomes visible when it's
expression evaluates to 'm' or 'y'.
...

<--  snip  -->

The current implementation evaluates !m to 0 instead of 1.

An example:

config FOO
        tristate
        default m

config BAR
        tristate
        default y if !FOO
        default n


According to the kconfig spec BAR should be y, but the implementation in
2.6.0-mm5 sets BAR to n.

BTW:
The semantics of the implemention seems to be a bit less surprising 
than the semantics of the spec.

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.6 bug: kconfig implementation doesn't match the spec
  2003-08-08 14:51 2.6 bug: kconfig implementation doesn't match the spec Adrian Bunk
@ 2003-08-08 15:16 ` Roman Zippel
  2003-08-08 17:47   ` Adrian Bunk
  0 siblings, 1 reply; 5+ messages in thread
From: Roman Zippel @ 2003-08-08 15:16 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

Hi,

On Fri, 8 Aug 2003, Adrian Bunk wrote:

> An example:
> 
> config FOO
>         tristate
>         default m
> 
> config BAR
>         tristate
>         default y if !FOO
>         default n
> 
> 
> According to the kconfig spec BAR should be y, but the implementation in
> 2.6.0-mm5 sets BAR to n.

You probably forgot to set MODULES, tristate behaves like bool in this 
case and FOO becomes 'y' and '!FOO' is 'n'.

bye, Roman


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.6 bug: kconfig implementation doesn't match the spec
  2003-08-08 15:16 ` Roman Zippel
@ 2003-08-08 17:47   ` Adrian Bunk
  2003-08-08 18:01     ` Roman Zippel
  0 siblings, 1 reply; 5+ messages in thread
From: Adrian Bunk @ 2003-08-08 17:47 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel

On Fri, Aug 08, 2003 at 05:16:09PM +0200, Roman Zippel wrote:
> Hi,
> 
> On Fri, 8 Aug 2003, Adrian Bunk wrote:
> 
> > An example:
> > 
> > config FOO
> >         tristate
> >         default m
> > 
> > config BAR
> >         tristate
> >         default y if !FOO
> >         default n
> > 
> > 
> > According to the kconfig spec BAR should be y, but the implementation in
> > 2.6.0-mm5 sets BAR to n.
> 
> You probably forgot to set MODULES, tristate behaves like bool in this 
> case and FOO becomes 'y' and '!FOO' is 'n'.

No, this is with CONFIG_MODULES=y.

Let me give another example where the kconfig implementation is 
completely broken (BTW: again with CONFIG_MODULES=y):

According to your language definition,
  m && !m
evaluates to "m" (it sounds a bit strange but follows directly from
rules (5) and (7) together with the interpretation of "m" as 1 as 
explained in the section "Menu dependencies" of
Documentation/kbuild/kconfig-language.txt).

Let's take the following Kconfig snippet:

config MOD
        tristate
        default m

config TEST8
        tristate
        default MOD && !MOD

config TEST9
        tristate
        default m && !m

With the explations above it's obvious both TEST8 and TEST9 should be 
"m", but the current 2.6 kconfig implementation says:

# CONFIG_TEST8 is not set
CONFIG_TEST9=y


That's not only different from the expected result directly derived from 
the language definition, it also gives two completely different results 
for the same expression!


> bye, Roman

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.6 bug: kconfig implementation doesn't match the spec
  2003-08-08 17:47   ` Adrian Bunk
@ 2003-08-08 18:01     ` Roman Zippel
  2003-08-08 18:16       ` Adrian Bunk
  0 siblings, 1 reply; 5+ messages in thread
From: Roman Zippel @ 2003-08-08 18:01 UTC (permalink / raw)
  To: Adrian Bunk; +Cc: linux-kernel

Hi,

On Fri, 8 Aug 2003, Adrian Bunk wrote:

> > You probably forgot to set MODULES, tristate behaves like bool in this 
> > case and FOO becomes 'y' and '!FOO' is 'n'.
> 
> No, this is with CONFIG_MODULES=y.

How did you set it? I tried your examples and got the expected and correct 
result.

> According to your language definition,
>   m && !m
> evaluates to "m" (it sounds a bit strange but follows directly from
> rules (5) and (7) together with the interpretation of "m" as 1 as 
> explained in the section "Menu dependencies" of
> Documentation/kbuild/kconfig-language.txt).

BTW the reason for (5) !<expr> -> 2-<expr> is that it becomes possible to 
do various transformations with the expressions, e.g. !!<expr> == <expr>.

bye, Roman


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: 2.6 bug: kconfig implementation doesn't match the spec
  2003-08-08 18:01     ` Roman Zippel
@ 2003-08-08 18:16       ` Adrian Bunk
  0 siblings, 0 replies; 5+ messages in thread
From: Adrian Bunk @ 2003-08-08 18:16 UTC (permalink / raw)
  To: Roman Zippel; +Cc: linux-kernel

On Fri, Aug 08, 2003 at 08:01:20PM +0200, Roman Zippel wrote:

> Hi,

Hi Roman,

> On Fri, 8 Aug 2003, Adrian Bunk wrote:
> 
> > > You probably forgot to set MODULES, tristate behaves like bool in this 
> > > case and FOO becomes 'y' and '!FOO' is 'n'.
> > 
> > No, this is with CONFIG_MODULES=y.
> 
> How did you set it? I tried your examples and got the expected and correct 
> result.

ups, sorry, you are right. I switched between two trees and these 
examples were with CONFIG_MODULES=n. With CONFIG_MODULES=y I observe the 
correct results.

> > According to your language definition,
> >   m && !m
> > evaluates to "m" (it sounds a bit strange but follows directly from
> > rules (5) and (7) together with the interpretation of "m" as 1 as 
> > explained in the section "Menu dependencies" of
> > Documentation/kbuild/kconfig-language.txt).
> 
> BTW the reason for (5) !<expr> -> 2-<expr> is that it becomes possible to 
> do various transformations with the expressions, e.g. !!<expr> == <expr>.

OTOH, the expression
  FOO && !FOO
is not always "n" as you might expect.

> bye, Roman

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-08-08 18:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-08-08 14:51 2.6 bug: kconfig implementation doesn't match the spec Adrian Bunk
2003-08-08 15:16 ` Roman Zippel
2003-08-08 17:47   ` Adrian Bunk
2003-08-08 18:01     ` Roman Zippel
2003-08-08 18:16       ` Adrian Bunk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).