NetBSD-Bugs archive

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

bin/43821: make: longstanding bug with loop variables



>Number:         43821
>Category:       bin
>Synopsis:       make: oldstanding bug with loop variables
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Aug 31 12:20:00 +0000 2010
>Originator:     Aleksey Cheusov
>Release:        Linux 2.6.18-194.el5xen
>Organization:
<organization of PR author (multiple lines)>
>Environment:
System: Linux centos.imb.invention.com 2.6.18-194.el5xen #1 SMP Fri Apr 2 
16:16:54 EDT 2010 i686 i686 i386 GNU/Linux
Architecture: i686

>Description:

    .for i in 1 2
    .if empty(i:M2)
    res=passed
    .endif
    .endfor

    all:
            @echo ${res}

With Makefile shown above bmake works like this

    0 cheusov>nbmake -f ~/tmp/2.mk
    nbmake: "/home/cheusov/tmp/2.mk" line 2: Malformed conditional (empty(i:M2))
    nbmake: "/home/cheusov/tmp/2.mk" line 2: Malformed conditional (empty(i:M2))
    nbmake: Fatal errors encountered -- cannot continue

    nbmake: stopped in /home/cheusov
    1 cheusov>

At the same time 

    .for i in 1 2
    j=${i}
    .if empty(j:M2)
    res=passed
    .endif
    .endfor

    all:
            @echo ${res}

works normally.

    0 cheusov>nbmake -f ~/tmp/2.mk
    passed
    0 cheusov>

As far as I understand this bug is very old. In bsd.subdir.mk
we can see

    # for obscure reasons, we can't do a simple .if ${dir} == ".WAIT"
    # but have to assign to __TARGDIR first.
    .for targ in ${TARGETS}
    .for dir in ${__REALSUBDIR}
    __TARGDIR := ${dir}
    .if ${__TARGDIR} == ".WAIT"

but I cannot find any explanation in bmake.1.
So, I assume this is a bug and hope it can be fixed.

>How-To-Repeat:
>Fix:



Home | Main Index | Thread Index | Old Index