NetBSD-Bugs archive

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

bin/39501: the new invalid regexp warning sometimes causes awk to bomb

>Number:         39501
>Category:       bin
>Synopsis:       the new invalid regexp warning sometimes causes awk to bomb
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Sep 08 03:05:00 +0000 2008
>Originator:     David A. Holland
>Release:        NetBSD 4.99.72 (20080907)
System: NetBSD tanaqui 4.99.54 NetBSD 4.99.54 (TANAQUI) #21: Fri Feb 29 
12:31:31 EST 2008 dholland@tanaqui:/usr/src/sys/arch/i386/compile/TANAQUI i386
Architecture: i386
Machine: i386

Sometimes (usually in nontrivial cases in the middle of large builds),
the new warning in awk about invalid regexp strings like "\." causes a
syntax error as well as the intended warning.


Here's a relatively small test case.
(Derived from pkgsrc/mk/scripts/genindex.awk; see PR 39339. It has
8-space tabs and no trailing whitespace, which may be important, as
the exact formatting matters.)


        exit 0;

function find_all_depends(pkg, type, pkgreg, i, deps, depdir, topdep){

        alldepends[pkg] = " ";

        alldepends[pkg] = uniq(alldepends[pkg]);
        if (debug) printf("\tuniq() output alldepends[%s] = %s\n",
                          pkg, alldepends[pkg]);

function reg2str(reg){
        gsub(/\./, "\\\.", reg);
        gsub(/\+/, "\\\+", reg);
        gsub(/\*/, "\\\*", reg);
        gsub(/\?/, "\\\?", reg);
        gsub(/\[/, "\\\[", reg);
        gsub(/\]/, "\\\]", reg);
        reg = " "reg" ";

function uniq(list, deps, i, ulist){
        ulist = " ";



The problem is that the code that prints the context of a diagnostic
message [eprint() in lib.c] attempts to read from the input buffer
[input() in lex.c] and restore it when it's done, I think, but it
doesn't always work. In fact, I don't particularly understand what
it's trying to do at all, so I'm not sure how to fix it.

It might be an adequate workaround to avoid calling eprint() from
WARNING(), but it'd be better to fix it properly...

Home | Main Index | Thread Index | Old Index