Re: [2.2.0-pre4][alpha] problems and patch

Michael Elizabeth Chastain (mec@shout.net)
Tue, 5 Jan 1999 03:42:56 -0600


Hi Guys,

I nailed this bug! It has nothing to do with redundant CONFIG_EXPERIMENTAL.
My intuition was mostly wrong.

Here is a patch against 2.2.0-pre4:

ftp://ftp.shout.net/pub/users/mec/experimental/xconfig-clear.diff

The patch is short so I have attached it. Also I have attached an
explanation after my signature so that people who don't want graphic
detail can skip it.

I read the scripts for all architectures. ARCH=ppc has the same problem
with CONFIG_SOUND and CONFIG_SOUND_OSS, and this patches fixes it for me.

Do please test this patch and send me a report. I feel much more
comfortable when I have two or three "it works for me" reports in hand
before I officially submit to Alan Cox. If you want to test on an i386,
just do "make ARCH=alpha xconfig" or "make ARCH=ppc xconfig" before and
after the patch.

Michael Elizabeth Chastain
<mailto:mec@shout.net>
"love without fear"

===

diff -u -r -N linux-2.2.0-pre4/scripts/tkgen.c linux/scripts/tkgen.c
--- linux-2.2.0-pre4/scripts/tkgen.c Wed Apr 1 17:10:14 1998
+++ linux/scripts/tkgen.c Mon Jan 4 15:03:19 1999
@@ -69,6 +69,11 @@
* 0: they may have been set to 1 elsewhere. CONFIG_NETLINK is
* an example.
*
+ * 1999 01 04
+ * Michael Elizabeth Chastain <mec@shout.net>
+ * - Call clear_globalflags when writing out update_mainmenu.
+ * This fixes the missing global/vfix lines for ARCH=alpha on 2.2.0-pre4.
+ *
* TO DO:
* - clean up - there are useless ifdef's everywhere.
* - better comments throughout - C code generating tcl is really cryptic.
@@ -912,6 +917,7 @@
* the top level menu, and this procedure will ensure that things are
* correct.
*/
+ clear_globalflags(scfg);
printf("proc update_mainmenu {w} {\n");
for(cfg = scfg; cfg != NULL; cfg = cfg->next)
{

===

Here is the explanation: tkgen.c wants to emit "global / vfix" lines
for each variable used in each menu update function. It has a set of
flags that track which variables it has emitted, so that it only has to
write one "global / vfix" line per variable per menu. And it resets
these flags at the beginning of each menu.

The bug is that tkgen.c neglected to clear the flags at the beginning
of the main menu. So whatever "global / vfix" lines were emitted for
the last menu in the configuration, tkgen.c thought those were still
available in update_mainmenu.

Here is the last menu of arch/i386/config.in:

mainmenu_option next_comment
comment 'Kernel hacking'
#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
tristate 'Kernel FP software completion' CONFIG_MATHEMU
else
define_bool CONFIG_MATHEMU y
fi
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
endmenu

See, it uses the value of $CONFIG_EXPERIMENTAL. So update_mainmenu
thinks that CONFIG_EXPERIMENTAL has already been declared when it
hasn't. Blooie, undefined variable.

In contrast, here is the last menu of arch/i386/config.in:

mainmenu_option next_comment
comment 'Kernel hacking'
#bool 'Debug kmalloc/kfree' CONFIG_DEBUG_MALLOC
bool 'Magic SysRq key' CONFIG_MAGIC_SYSRQ
endmenu

See, no values being used. (Using the value, not setting the value,
is the important part). That's why the bug didn't manifest on i386.

-
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/