Messages in this thread | | | Date | Sat, 2 Jan 1999 03:39:13 -0600 | From | Michael Elizabeth Chastain <> | Subject | Re: details on make xconfig bug in pre2 |
| |
Hi Les,
> Have I missed something?
Yes, your patch is completely broken, ouch! It suppresses the error and generates incorrect TCL code.
Suppose you write this code:
mainmenu_name "Test Configuration File"
mainmenu_option next_comment comment 'Whatever'
choice 'foo' \ "Alpha CONFIG_FOO_ALPHA \ Beta CONFIG_FOO_BETA \ Gamma CONFIG_FOO_GAMMA" Alpha
if [ "$CONFIG_FOO_ALPHA" = "y" ]; then define_bool CONFIG_BAR y fi
endmenu
xconfig rewrites this test as if the original source were:
if [ "$tmpvar_0" = "Alpha" ]; then define_bool CONFIG_BAR y fi
tmpvar_0 is a temporary variable which holds the string value of the 'choice' statement. xconfig prefers to work with tmpvar_0 rather than CONFIG_FOO_*. In fact, CONFIG_FOO_* do not even exist the same way as other variables such as CONFIG_BAR do. Only the tmpvar_0 variable is actually valid, and the CONFIG_FOO_* values are synthesized only on file output.
You can see this transformation for yourself by running scripts/tkparse with my sample program as standard input.
The function 'fix_choice_cond' transforms conditional tests like the transformation above. It is a cheesy function that does not work on all legal input. It can transform "$CONFIG_FOO_ALPHA" = "y", and it can transfrom "$CONFIG_FOO_ALPHA" != "y".
'fix_choice_cond' cannot transform expressions where the right-hand side equals "n" or "m" or anything other than "y". It just gives up and prints "Ooops".
With your patch applied, xconfig changes this code:
if [ "$CONFIG_FOO_ALPHA" = "n" ]; then define_bool CONFIG_BAR y fi
into this code:
if [ "$tmpvar_0" = "Alpha" ]; then define_bool CONFIG_BAR y fi
Notice how it emits the wrong boolean test.
Michael Elizabeth Chastain <mailto:mec@shout.net> "love without fear"
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |