[PATCH] fix segmentation fault in "make menuconfig" in current 2.4

Dan Kegel (dank@kegel.com)
Sat, 07 Jun 2003 23:40:03 -0700


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 (!):

--- linux-2.4.19/scripts/Menuconfig.old Sat Jun 7 23:07:37 2003
+++ linux-2.4.19/scripts/Menuconfig Sat Jun 7 23:08:24 2003
@@ -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

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

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/