Re: 'make menuconfig' crash in 2.2.0-pre*

Michael Elizabeth Chastain (mec@shout.net)
Sun, 3 Jan 1999 03:18:25 -0600


Hi Guys,

That was a good bug report; I was able to duplicate and isolate
with no fuss.

I found and fixed the bug. Please try the following patch and let me
know if it works for you.

ftp://ftp.shout.net/pub/users/mec/experimental/menuconfig-scroll.diff

This is against 2.2.0-pre4, but it ought to apply to any recent version.
I have also appended the patch to this letter.

There were two bugs here. The first bug was in the interface between
Menuconfig and lxdialog. lxdialog wants to write an lxdialog.scrltmp file
for the ' ' command (also for a lot of other commands, specifically 'y',
'm', 'n', and 's'). Menuconfig needs to blow away this file, because
Menuconfig knows it is changing the menu, and lxdialog does not know
about that.

The second bug is a coding bug in the scrltmp recovery logic where, if
the value of 'scroll' is out of bounds, the code keeps the out-of-bounds
value and starts using it (see the call to print_arrows and all the
code after the main wgetch). That explains why the menu looks normal
at first and then prints semi-random lines as you arrow around in it.

I fixed this the obvious way: by resetting 'scroll' to 0 in that
code path.

This is all in Clifford Wolf's recent code -- Clifford, would you please
have a look at this letter and my patch and tell me whether I have
missed anything here.

So try it out and let me know how it works. If it works fine, then I
will submit it to Linus.

Cheers,

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

===

diff -u -r -N linux-2.2.0-pre4/scripts/Menuconfig linux/scripts/Menuconfig
--- linux-2.2.0-pre4/scripts/Menuconfig Wed Dec 23 09:26:32 1998
+++ linux/scripts/Menuconfig Sat Jan 2 14:59:04 1999
@@ -57,6 +57,10 @@
# 13 Dec 1998, Riley H Williams (rhw@bigfoot.com)
# When an error occurs, actually display the error message as well as
# our comments thereon.
+#
+# 02 January 1999, Michael Elizabeth Chastain (mec@shout.net)
+# Blow away lxdialog.scrltmp on entry to activate_menu. This protects
+# against people who use commands like ' ' to select menus.


#
@@ -720,6 +724,7 @@
# dialog commands or recursively call other menus.
#
function activate_menu () {
+ rm -f lxdialog.scrltmp
while true
do
comment_ctr=0 #So comment lines get unique tags
diff -u -r -N linux-2.2.0-pre4/scripts/lxdialog/menubox.c linux/scripts/lxdialog/menubox.c
--- linux-2.2.0-pre4/scripts/lxdialog/menubox.c Sun Nov 8 16:36:46 1998
+++ linux/scripts/lxdialog/menubox.c Sat Jan 2 14:47:07 1999
@@ -48,6 +48,12 @@
* *) If for some reason the last scrolling position is not saved by
* lxdialog, it sets the scrolling so that the selected item is in the
* middle of the menu box, not at the bottom.
+ *
+ * 02 January 1999, Michael Elizabeth Chastain (mec@shout.net)
+ * Reset 'scroll' to 0 if the value from lxdialog.scrltmp is bogus.
+ * This fixes a bug in Menuconfig where using ' ' to descend into menus
+ * would leave mis-synchronized lxdialog.scrltmp files lying around,
+ * fscanf would read in 'scroll', and eventually that value would get used.
*/

#include "dialog.h"
@@ -227,6 +233,7 @@
choice = choice - scroll;
fclose(f);
} else {
+ scroll=0;
remove("lxdialog.scrltmp");
fclose(f);
f=NULL;

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