Subject: bin/3825: Bug in make's regexp handling
To: None <gnats-bugs@gnats.netbsd.org>
From: None <dholland@eecs.harvard.edu>
List: netbsd-bugs
Date: 07/02/1997 17:55:02
>Number:         3825
>Category:       bin
>Synopsis:       make matches regexps incorrectly
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Jul  4 03:50:03 1997
>Last-Modified:
>Originator:     David A. Holland <dholland@eecs.harvard.edu>
>Organization:
   - David A. Holland             |    VINO project home page:
     dholland@eecs.harvard.edu    | http://www.eecs.harvard.edu/vino
>Release:        NetBSD-current 19970410
>Environment:
	

This was actually discovered in a version of make with a couple of local 
hacks for driving BSD/OS to VINO cross-compilation, but it occurs on
stock NetBSD-current also:

System: NetBSD bordeaux 1.2C NetBSD 1.2C (BORDEAUX.PROF) #28: Sat Mar 1 16:28:54 EST 1997 abrown@bordeaux:/usr/src/sys/arch/i386/compile/BORDEAUX.PROF i386


>Description:

If you use the C modifier (regexp matching/substitution) to a
variable, instead of doing the conventional thing, that is, taking the
longest possible match, it seems to take the first (and generally the
shortest) possible match. If you run the provided makefile, the first
echo prints "bzzzt", which I believe to be wrong, although this is
probably open to debate.

However, the second substitution causes make to hang, I suspect
because it's trying to replace the empty string with another empty
string until it can find no more empty strings.

>How-To-Repeat:

 --------- snip --- Makefile (5 lines) --------
BAR=bzzzt

foo:
        @echo ${BAR:C/z*//}
        @echo ${BAR:C/z*//g}

>Fix:

I don't have a fix for this and I don't see any immediately obvious reason
in the code, but I haven't looked all that closely.

>Audit-Trail:
>Unformatted: