From nobody@FreeBSD.org  Mon Feb 14 07:21:03 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 19FF3106566C
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Feb 2011 07:21:03 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id 07E568FC17
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Feb 2011 07:21:03 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p1E7L2pY044004
	for <freebsd-gnats-submit@FreeBSD.org>; Mon, 14 Feb 2011 07:21:02 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p1E7L2DA044003;
	Mon, 14 Feb 2011 07:21:02 GMT
	(envelope-from nobody)
Message-Id: <201102140721.p1E7L2DA044003@red.freebsd.org>
Date: Mon, 14 Feb 2011 07:21:02 GMT
From: Garrett Cooper <yaneurabeya@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: [make] :L modifier broken in quoted strings
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         154769
>Category:       bin
>Synopsis:       make(1): :L modifier broken in quoted strings
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Feb 14 07:30:09 UTC 2011
>Closed-Date:    
>Last-Modified:  Sun Feb 03 22:29:08 UTC 2013
>Originator:     Garrett Cooper
>Release:        CURRENT / 8.1-RELEASE
>Organization:
n/a
>Environment:
FreeBSD bayonetta.local 9.0-CURRENT FreeBSD 9.0-CURRENT #0 r218082M: Sun Jan 30 00:20:08 PST 2011     gcooper@bayonetta.local:/usr/obj/usr/src/sys/BAYONETTA  amd64
FreeBSD toaster.local 8.1-RELEASE FreeBSD 8.1-RELEASE #0 r216175: Mon Dec  6 01:40:05 PST 2010     gcooper@toaster.local:/usr/obj/usr/src/sys/BREADBOX  i386
>Description:
Quoted variables don't appear to expand properly with some operators like :L at least. Both CURRENT and 8.1-RELEASE show the same behavior with FreeBSD's make, which is the conditional appears "malformed"...

> cat Makefile.1
FOO?=	bar
.if "${FOO:L}" == "bar"
.warning "match!"
.else
.warning "no match!"
.endif
> make -f Makefile.1 FOO=bar
"Makefile.1", line 2: Malformed conditional ("${FOO:L}" == "bar")
"Makefile.1", line 3: "match!"

.. unquoting the variable works though without the malformed conditional noise...

> cat Makefile.2
FOO?=	bar
.if ${FOO:L} == "bar"
.warning "match!"
.else
.warning "no match!"
.endif
> make -f Makefile.2 FOO=bar
"Makefile", line 3: warning: "match!"
make: no target to make.

bmake (NetBSD's make) doesn't have this malformed conditional issue...

$ bmake -f Makefile.1 FOO=bar
bmake: "Makefile.1" line 6: warning: "no match!"

.. but the problem is that bmake doesn't correctly evaluate the expansion to be true when quoted or not quoted; that's a separate bug for the NetBSD folks though.
>How-To-Repeat:
Repeat as shown above.
>Fix:


>Release-Note:
>Audit-Trail:

From: Garrett Cooper <yaneurabeya@gmail.com>
To: bug-followup@FreeBSD.org, gcooper@FreeBSD.org
Cc:  
Subject: Re: bin/154769: [make] :L modifier broken in quoted strings
Date: Mon, 14 Feb 2011 00:34:35 -0800

     As was pointed out by me by someone else, bmake's :L modifier is
 not the same as FreeBSD's :L modifier.
 Thanks,
 -Garrett

From: Anonymous <swell.k@gmail.com>
To: Garrett Cooper <yaneurabeya@gmail.com>
Cc: bug-followup@FreeBSD.org
Subject: Re: bin/154769: [make] :L modifier broken in quoted strings
Date: Mon, 14 Feb 2011 15:05:38 +0300

 Garrett Cooper <yaneurabeya@gmail.com> writes:
 
 >> cat Makefile.1
 > FOO?=	bar
 > .if "${FOO:L}" == "bar"
 > .warning "match!"
 > .else
 > .warning "no match!"
 > .endif
 >> make -f Makefile.1 FOO=bar
 > "Makefile.1", line 2: Malformed conditional ("${FOO:L}" == "bar")
 > "Makefile.1", line 3: "match!"
 >
 > .. unquoting the variable works though without the malformed
 > conditional noise...
 
 You can reduce example to
 
   .if "bar" == "bar"
   .warning "match!"
   .endif
 
 and make(1) would still produce
 
   $ make
   "Makefile", line 1: Malformed conditional ("bar" == "bar")
   "Makefile", line 2: warning: "match!"
   "Makefile", line 3: if-less endif
 
 It was fixed in bmake circa 2004
 
   http://mail-index.netbsd.org/source-changes/2004/04/13/msg145128.html

From: Garrett Cooper <yaneurabeya@gmail.com>
To: bug-followup@FreeBSD.org, gcooper@FreeBSD.org
Cc: "Simon J. Gerraty" <sjg@juniper.net>
Subject: Re: bin/154769: make(1): :L modifier broken in quoted strings
Date: Fri, 30 Nov 2012 19:43:50 -0800

     Please close this PR once fmake is killed in base.
 Thanks!
 -Garrett
>Unformatted:
