Bug 154769 - make(1): :L modifier broken in quoted strings
Summary: make(1): :L modifier broken in quoted strings
Status: Closed Not Accepted
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 8.1-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-14 07:30 UTC by Enji Cooper
Modified: 2014-08-15 21:47 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2011-02-14 07:30:09 UTC
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.
Comment 1 Enji Cooper freebsd_committer freebsd_triage 2011-02-14 08:34:35 UTC
    As was pointed out by me by someone else, bmake's :L modifier is
not the same as FreeBSD's :L modifier.
Thanks,
-Garrett
Comment 2 swell.k 2011-02-14 12:05:38 UTC
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
Comment 3 Enji Cooper freebsd_committer freebsd_triage 2012-12-01 03:43:50 UTC
    Please close this PR once fmake is killed in base.
Thanks!
-Garrett
Comment 4 Enji Cooper freebsd_committer freebsd_triage 2014-08-15 21:47:04 UTC
fmake is no longer being developed, so I'm closing this PR with "Feature Proposal Rejected" (it was the closest thing I could find to "WONTFIX").