NetBSD Problem Report #14615

Received: (qmail 27304 invoked from network); 17 Nov 2001 15:34:59 -0000
Message-Id: <200111171534.fAHFYvw05335@ultra1.eis.cs.tu-bs.de>
Date: Sat, 17 Nov 2001 16:34:57 +0100 (MET)
From: Juergen Hannken-Illjes <hannken@eis.cs.tu-bs.de>
To: gnats-bugs@gnats.netbsd.org
Subject: make with MAKEOBJDIR set behaves strange on sub-makes

>Number:         14615
>Category:       toolchain
>Synopsis:       make with MAKEOBJDIR set behaves strange on sub-makes
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    toolchain-manager
>State:          suspended
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Nov 17 15:35:01 +0000 2001
>Closed-Date:    
>Last-Modified:  Tue Feb 12 08:57:07 +0000 2002
>Originator:     Juergen Hannken-Illjes
>Release:        NetBSD 1.5Y as of Nov 16, 2001
>Organization:
	TU Braunschweig / EIS
>Environment:
System: NetBSD 1.5Y (CUSTOM) #75: Fri Nov 16 10:54:43 MET 2001
Architecture: i386
Machine: i386
>Description:
	make(1) contains logic to check the shell commands for occurences
	of `make' or `${MAKE}' commands. If MAKEOBJDIR is set and a shell
	command contains `make' and this is not preceded by a `chdir' or
	`cd' the command will run in ${.SRCDIR}. This behaviour is not
	documented outside the code (main.c). The logic is buggy as it
	doesn't detect commands after `if', `then' etc.
>How-To-Repeat:
	Run the following shell script and try to explain the result:

#! /bin/sh

mkdir -p /tmp/test/src /tmp/test/obj

cat <<'EOF' >/tmp/test/src/Makefile

a b0 c0 d0:
	@echo "${.TARGET}:	src `pwd`"

b:
	@${MAKE} b0

c:
	@cd . && ${MAKE} c0

d:
	@if true; then cd . && ${MAKE} d0; fi

EOF

cat <<'EOF' >/tmp/test/obj/Makefile

a b c d b0 c0 d0:
	@echo "${.TARGET}:	obj `pwd`"

EOF

export MAKEOBJDIR='${.CURDIR:C,^/tmp/test/src,//tmp/test/obj,}'

(cd /tmp/test/src && make a b c d)

	My result is:

a:	src /tmp/test/obj
b0:	src /tmp/test/obj
c0:	obj /tmp/test/obj
d0:	src /tmp/test/obj

>Fix:
	1. update the documentation so the current behaviour is documented
	   and fix the simple shell parser.
	2. simply remove the chdir-checks and correct the offending Makefiles.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->suspended 
State-Changed-By: tv 
State-Changed-When: Mon Dec 17 10:55:57 PST 2001 
State-Changed-Why:  
The problem which triggered this PR was fixed, but there's still lingering issues 
in make(1).  We may want to remove the chdir checks entirely. 
Responsible-Changed-From-To: bin-bug-people->toolchain-manager 
Responsible-Changed-By: gnats 
Responsible-Changed-When: Tue Feb 12 00:57:05 PST 2002 
Responsible-Changed-Why:  
There is now a "toolchain-manager" which is the proper default role 
account for handling problem reports in the toolchain category. 

>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.