NetBSD Problem Report #29985

From roland@roland-illig.de  Fri Apr 15 23:40:05 2005
Return-Path: <roland@roland-illig.de>
Received: from baccf5ee.roland-illig.de (d059146.adsl.hansenet.de [80.171.59.146])
	by narn.netbsd.org (Postfix) with ESMTP id E6EBE63B116
	for <gnats-bugs@gnats.netbsd.org>; Fri, 15 Apr 2005 23:40:04 +0000 (UTC)
Message-Id: <20050415234004.0CC4CF594@baccf5ee.roland-illig.de>
Date: Sat, 16 Apr 2005 01:40:04 +0200 (CEST)
From: roland.illig@gmx.de
Reply-To: roland.illig@gmx.de
To: gnats-bugs@netbsd.org
Subject: make(1) interprets backslash wrongly
X-Send-Pr-Version: 3.95

>Number:         29985
>Category:       bin
>Synopsis:       make(1) interprets backslash wrongly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Apr 15 23:41:00 +0000 2005
>Closed-Date:    Fri Jul 01 16:46:16 +0000 2005
>Last-Modified:  Tue Sep 22 19:10:01 +0000 2020
>Originator:     roland.illig@gmx.de
>Release:        NetBSD 2.99.15
>Organization:

>Environment:


System: NetBSD baccf5ee.roland-illig.de 2.99.15 NetBSD 2.99.15 (GENERIC) #0: Wed Feb 9 20:19:30 CET 2005 build@baccf5ee.roland-illig.de:/home/build/objroot/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
Userland: NetBSD-1.6.2
>Description:

	The NetBSD-1.6.2 make(1), the current pkgsrc bmake, and the
	NetBSD-2.99.15 make(1) all handle backspace characters as line-
	continuations when they appear as substitutions at the end of a
	line inside a .for loop.

	The documentation does not mention how backspace characters are
	interpreted except in a few special cases. I expect that back-
	space characters are only handled specially when they appear as
	tokens in a Makefile, not as values of a variable substitution.

	The appended code sample demonstrates that the backslash in a:\
	is properly quoted by the :Q operator, but after that is inter-
	preted as a backslash character that concatenates the two `echo'
	lines.

	Actually I'm not sure how to fix this. At least the documenta-
	tion of make(1) should mention this behaviour, as it is unex-
	pected.

>How-To-Repeat:

	A=	a:\ a:\file.txt
	all:
	.for a in ${A}
		echo ${a:Q}
		echo "<"${a:Q}">"
	.endfor

>Fix:

	Make(1) should process Makefiles in the following order:

	1. read in a logical line
	2. Do variable substitutions
	3. append the substituted line

	The code in src/usr.bin/make/for.c, lines 371..375 seems to be
	responsible for this behaviour.

>Release-Note:

>Audit-Trail:

State-Changed-From-To: open->closed
State-Changed-By: christos@netbsd.org
State-Changed-When: Fri, 01 Jul 2005 12:46:16 -0400
State-Changed-Why:
fixed, thanks


From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29985 CVS commit: src/usr.bin/make
Date: Fri,  1 Jul 2005 16:45:38 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Fri Jul  1 16:45:38 UTC 2005

 Modified Files:
 	src/usr.bin/make: var.c

 Log Message:
 PR/29985: Roland Illig: make(1) interprets backslash wrongly in for
 loop expansions, when the expanded variable ends in backslash and
 the backslash is the last character on the line. While this fix is
 ugly (detect the condition and append a space), it is the least
 intrusive for now.


 To generate a diff of this commit:
 cvs rdiff -r1.95 -r1.96 src/usr.bin/make/var.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Roland Illig" <rillig@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/29985 CVS commit: src/usr.bin/make/unit-tests
Date: Tue, 22 Sep 2020 18:54:51 +0000

 Module Name:	src
 Committed By:	rillig
 Date:		Tue Sep 22 18:54:51 UTC 2020

 Modified Files:
 	src/usr.bin/make/unit-tests: directive-for.exp directive-for.mk

 Log Message:
 make(1): add test for .for loop from PR bin/29985


 To generate a diff of this commit:
 cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-for.exp
 cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-for.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: "Roland Illig" <rillig@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/29985 CVS commit: src/usr.bin/make
Date: Tue, 22 Sep 2020 19:08:48 +0000

 Module Name:	src
 Committed By:	rillig
 Date:		Tue Sep 22 19:08:48 UTC 2020

 Modified Files:
 	src/usr.bin/make: var.c
 	src/usr.bin/make/unit-tests: directive-for.exp directive-for.mk

 Log Message:
 make(1): remove obsolete fix for PR bin/29985


 To generate a diff of this commit:
 cvs rdiff -u -r1.531 -r1.532 src/usr.bin/make/var.c
 cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-for.exp
 cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-for.mk

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.