tech-userlevel archive

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

Re: regression/bug in /usr/bin/make



On Sat, Sep 05, 2009 at 08:22:39PM +0300, Aleksey Cheusov wrote:
> 
> I think I've found a bug in make.
> 
> Makefile:
>     var = head
>     res = no
> 
>     .for i in head:tail
>     .if !empty(var:M${i:C/:.*//})
>         res=yes
>     .endif
>     .endfor
> 
>     all:
>         @echo ${res}
> 
> shell session:
>     0 ~>/usr/bin/make -f /home/cheusov/tmp/1.mk all 
>     make: Bad modifier `:tail' for 
>     no
>     0 ~>
> 
> This is how NetBSD-5 make and current make work.
> 
> The problem here is that "head" and "tail" are separated by colon.
> C/:.*// for unknown reason doesn't work.

It doesn't fail there, .for loop variables get substitued in an odd way
(so that they remain variable substitutions).
So you are trying to evaluate (and which fails the same way):
        .if !empty(var:M${:Uhead\:tail:C/:.*//})
Since the .for code tries to escape the ':'.

Interestingly adding a 2nd '\' makes the above work.
And there aren't many places where a '\' is a character escape.
 
> Should I send PR?

Probably, I'm not going to look any further now.

> P.S.
> bmake-20081111 by sjg@ worked perfectly.
No it didn't :-) just a different set of bugs.

        David

-- 
David Laight: david%l8s.co.uk@localhost


Home | Main Index | Thread Index | Old Index