Skip to contentSkip to conversation

fix segmentation fault in "make menuconfig" in current 2.4

PATCH New Dan Kegel 1 participant 1 message Jun 8, 2003

lore
Share & tools
lore

Dan Kegel

author
#0 lore raw

PATCH 1/1 fix segmentation fault in "make menuconfig" in current 2.4

I just ran into the following error:
~/linux-2.4.19$ make ARCH=arm menuconfig
...
/bin/sh scripts/Menuconfig arch/arm/config.in
Using defaults found in arch/arm/defconfig
Preparing scripts: functions, parsingscripts/Menuconfig: line 1: 21468 Segmentation fault awk "$1"
Awk died with error code 139. Giving up.
make: *** [menuconfig] Error 1

Looks like it's been reported before; Menuconfig has two mistakes in how it handles missing files in its awk sections.
See http://mail.gnu.org/archive/html/bug-gnu-utils/2001-10/msg00155.html
Even 2.4.21-rc7 seems to still contain the bug (unless I squinted wrong).

Here's a patch relative to 2.4.19 that gets rid of the awk crash, as recommended by Arnold Robbins (!):

scripts/Menuconfig renamed from scripts/Menuconfig.old +2 -2
@@ -714,7 +714,7 @@
 
 function parser(ifile,menu) {
 
-	while (getline <ifile) {
+	while ((getline <ifile) > 0) {
 		if ($1 == "mainmenu_option") {
 			comment_is_option = "1"
 		}
@@ -761,7 +761,7 @@
 
 function parser(ifile,menu) {
 
-	while (getline <ifile) {
+	while ((getline <ifile) > 0) {
 		if ($0 ~ /^#|$MAKE|mainmenu_name/) {
 			printf("") >>menu
 		}

Once that's applied, Menuconfig produces a more useful, though still bad, error message:

-----
scripts/Menuconfig: ./MCmenu0: line 63: syntax error near unexpected token fi' scripts/Menuconfig: ./MCmenu0: line 63: fi'
done.
^[[H^[[2J+ cat

Menuconfig has encountered a possible error in one of the kernel's configuration files and is unable to continue. Here is the error report:

Q> scripts/Menuconfig: MCmenu0: command not found
-----

Figuring out what's going on then requires commenting out the line in Menuconfig that removes MCmenu0.
The root cause of the error is that the file drivers/ssi/Config.in
is in the arm-linux kernel, but not in the vger kernel.
Sigh. So I only ran into the problem because I was trying to configure (let alone build) the vger kernel for arm, which apparantly is something nobody ever does.
- Dan

Signature · 3 lines
Dan Kegel
http://www.kegel.com
http://counter.li.org/cgi-bin/runscript/display-person.cgi?user=78045