NetBSD Problem Report #41998

From cheusov@tut.by  Sat Sep  5 20:11:59 2009
Return-Path: <cheusov@tut.by>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id AA3B563BC1D
	for <gnats-bugs@gnats.netbsd.org>; Sat,  5 Sep 2009 20:11:59 +0000 (UTC)
Message-Id: <s93hbvhb1e4.fsf@chen.chizhovka.net>
Date: Sat, 05 Sep 2009 23:08:19 +0300
From: cheusov@tut.by
To: gnats-bugs@gnats.NetBSD.org
Subject: /usr/bin/make: .for loop + ":" inside iter_var = bug
X-Send-Pr-Version: 3.95

>Number:         41998
>Category:       bin
>Synopsis:       /usr/bin/make: .for loop + ":" inside iter_var = bug
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    sjg
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Sep 05 20:15:00 +0000 2009
>Closed-Date:    Fri Nov 06 19:51:57 +0000 2009
>Last-Modified:  Fri Nov 06 19:51:57 +0000 2009
>Originator:     Aleksey Cheusov
>Release:        NetBSD 5.0_STABLE
>Organization:
>Environment:
System: NetBSD chen.chizhovka.net 5.0_STABLE NetBSD 5.0_STABLE (GENERIC) #6: Tue Aug 18 00:53:31 EEST 2009 cheusov@chen.chizhovka.net:/srv/obj/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:

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.

!! Simon Gerraty asked to assign this bug to him. !!

>How-To-Repeat:

>Fix:

Unknown
>Release-Note:

>Audit-Trail:
From: David Laight <david@l8s.co.uk>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: bin/41998: /usr/bin/make: .for loop + ":" inside iter_var = bug
Date: Sat, 5 Sep 2009 22:09:44 +0100

 On Sat, Sep 05, 2009 at 08:15:01PM +0000, cheusov@tut.by wrote:
 > >Number:         41998
 > >Category:       bin
 > >Synopsis:       /usr/bin/make: .for loop + ":" inside iter_var = bug

 .for variables are substituted by converting to ${U:<text>} in order
 to preserve the semantics of a variable substitution.
 The <text> gets certain characters \ escaped (including ':').

 The simpler test:

 .if ${:Uaaa\:bbb} == ""
 .endif

 also fails.

 The problem is that .if processing also strips escapes.

 Fix - one I've been thinking about - is to put .for variables into the
 symbol table, and only do the ${:U...} translation on text that is
 saved for parsing later (ie the body of rules).

 That saves processing most .for body text for these substitutions.

 	David

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

Responsible-Changed-From-To: bin-bug-people->sjg
Responsible-Changed-By: sjg@NetBSD.org
Responsible-Changed-When: Sat, 05 Sep 2009 21:49:29 +0000
Responsible-Changed-Why:
have a fix


State-Changed-From-To: open->closed
State-Changed-By: dsl@NetBSD.org
State-Changed-When: Fri, 06 Nov 2009 19:51:57 +0000
State-Changed-Why:
fixed by sjg in var.c 1.153 on sep 7


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.