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:  Mon Feb 14 22:20:01 +0000 2022
>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. 

From: Roland Illig <roland.illig@gmx.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: toolchain/14615
Date: Sat, 12 Feb 2022 00:16:32 +0100

 Here are some historical records of how the behavior of make changed
 between 1999 and 2022:

 1993.03.21.09.45.37
 | a:    src /tmp/test/src
 | b0:   src /tmp/test/src
 | c0:   src /tmp/test/src
 | d0:   src /tmp/test/src
 | exit status 0
 1999.12.27.18.37.04

 2000.05.04.18.29.12
 | a:    obj //tmp/test/obj
 | b:    obj //tmp/test/obj
 | c:    obj //tmp/test/obj
 | d:    obj //tmp/test/obj
 | exit status 0
 2001.01.07.06.08.33

 2001.01.07.06.16.02
 | a:    src //tmp/test/obj
 | b0:   src //tmp/test/obj
 | c0:   obj /tmp/test/obj
 | d0:   src //tmp/test/obj
 | exit status 0
 2013.01.23.00.06.39

 2013.01.25.02.01.10
 | a:    src //tmp/test/obj
 | b0:   obj /tmp/test/obj
 | c0:   obj /tmp/test/obj
 | d0:   obj /tmp/test/obj
 | exit status 0
 2016.11.10.23.41.58

 2016.12.07.15.00.46
 | a:    src /tmp/test/src
 | b0:   src /tmp/test/src
 | c0:   src /tmp/test/src
 | d0:   src /tmp/test/src
 | exit status 0
 2016.12.07.15.00.46

 2016.12.07.19.57.09
 | a:    src //tmp/test/obj
 | b0:   obj /tmp/test/obj
 | c0:   obj /tmp/test/obj
 | d0:   obj /tmp/test/obj
 | exit status 0
 current (as of 2022-02-12)

 The output from the PR doesn't exactly match the output from my suite of
 historical make versions, in addition the output changed quite a lot
 during the last 20 years.

 The statement that "The problem which triggered this PR was fixed" does
 not say when it was fixed, and the commits from
 https://github.com/NetBSD/src/commits/792e1d4ca9a0ffdc53315fed2498521d02f1=
 b618/usr.bin/make
 also don't clearly refer back to this PR.

 Seems to be still unsolved.

From: David Holland <dholland-bugs@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: toolchain/14615
Date: Mon, 14 Feb 2022 22:16:53 +0000

 On Fri, Feb 11, 2022 at 11:20:02PM +0000, Roland Illig wrote:
  >  Seems to be still unsolved.

 Everything about make's magic object directory behavior is a bug and
 the whole thing ought to be ripped out, except that we're also
 dependent on it. :-|

 -- 
 David A. Holland
 dholland@netbsd.org

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