bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gawk segmentation fault with Linux menuconfig


From: Aharon Robbins
Subject: Re: gawk segmentation fault with Linux menuconfig
Date: Sun, 14 Oct 2001 15:36:38 +0200

Greetings.  Re this:

> From: address@hidden (Andrew Church)
> To: address@hidden
> Subject: gawk segmentation fault with Linux menuconfig
> Date: Wed, 10 Oct 2001 08:50:12 JST
>
>      I recently came across what appears to be a problem with gawk: when
> running the Linux "menuconfig" script (scripts/Menuconfig in the kernel
> distribution), awk is called (around line 700 as of version 2.4.10) to
> parse the Config.in files; these files can recursively include other files
> (typically Config.in files from subdirectories).  However, if a file
> referenced does not exist, gawk will crash with a segmentation fault.
> I have reproduced this in Linux 2.4.10 by renaming net/ipv4/Config.in to
> net/ipv4/Config.inx so that it is not found during parsing.  I have not
> been able to narrow down the bug further due to a lack of experience with
> awk, but decided I should at least report the problem.
>
>   --Andrew Church
>     address@hidden
>     http://achurch.org/

I traced this down. It is is a bug in the Menuconfig program's use of awk.
There are two awk programs, each of which has a loop of the form:

        while (getline < ifile) {
                ....
        }

The problem is that getline returns -1 when it can't open the file, which
acts as a truth value (non-zero).  The correct way to code these loops is:

        while ((getline < ifile) > 0) {
                ....
        }

Without this, gawk goes into infinite recursion, eventually running
out of stack space or other memory.

I have bcc'ed the address given in Menuconfig; if you have a different/better
way to report a bug, please do that too.

Thanks,

Arnold Robbins



reply via email to

[Prev in Thread] Current Thread [Next in Thread]