NetBSD Problem Report #26329

Received: (qmail 17633 invoked by uid 605); 14 Jul 2004 19:43:13 -0000
Message-Id: <E1Bkpeo-0001AH-J1@quartz.newn.cam.ac.uk>
Date: Wed, 14 Jul 2004 20:43:10 +0100
From: prlw1@cam.ac.uk
Sender: gnats-bugs-owner@NetBSD.org
Reply-To: prlw1@cam.ac.uk
To: gnats-bugs@gnats.NetBSD.org
Subject: MKOBJDIRS and build.sh
X-Send-Pr-Version: 3.95

>Number:         26329
>Category:       toolchain
>Synopsis:       MKOBJDIRS=no impossible with build.sh
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jul 14 19:44:00 +0000 2004
>Closed-Date:    
>Last-Modified:  
>Originator:     Patrick Welche
>Release:        NetBSD 2.0G
>Organization:
>Environment:
>Description:
Revisiting MKOBJDIRS and build.sh, there is something wrong with
the ordering.  It is impossible to set MKOBJDIRS in mk.conf, and
only possible to have it set (to "no") by passing the -o flag to
build.sh.  This may not have been the original intention given the
following comment in build.sh:

        # Normalise MKOBJDIRS, MKUNPRIVED, and MKUPDATE
        # These may be set as build.sh options or in "mk.conf".
        # Don't export them as they're only used for tests in build.sh.
        #
        MKOBJDIRS=$(getmakevar MKOBJDIRS)      
        MKUNPRIVED=$(getmakevar MKUNPRIVED)
        MKUPDATE=$(getmakevar MKUPDATE)

The comment suggests they may be set in build.sh. Unfortunately,
by the time this code (in validatemakeparams()) is called, MAKEFLAGS
already contains MKOBJDIRS=yes, as set in parseoptions(), so
getmakevar, which calls make, which honours the environment variable
MAKEFLAGS, will return the value of MKOBJDIRS overriden by MAKEFLAGS
rather than the value it read from /etc/mk.conf (via
bsd.prog.mk->bsd.init.mk->bsd.own.mk)

One may take the opposite view, and suggest MKOBJDIRS should not be
settable, but then maybe that comment should be changed.

I would suggest delaying the application of the default "yes" until
after the getmakevar as per the attached patch.

(There probably is a neater syntax for the patch, but it shows what
I mean.)  
>How-To-Repeat:
echo "MKOBJDIRS=no">>/etc/mk.conf
/usr/src/build.sh build
>Fix:
Index: build.sh
===================================================================
RCS file: /cvsroot/src/build.sh,v
retrieving revision 1.130
diff -u -r1.130 build.sh
--- build.sh	2 Jul 2004 04:25:24 -0000	1.130
+++ build.sh	12 Jul 2004 18:07:39 -0000
@@ -657,7 +657,7 @@
 	setmakeenv LC_ALL C
 	makeenv="${makeenv} TOOLDIR MACHINE MACHINE_ARCH MAKEFLAGS"
 	[ -z "${BUILDID}" ] || makeenv="${makeenv} BUILDID"
-	MAKEFLAGS="-de -m ${TOP}/share/mk ${MAKEFLAGS} MKOBJDIRS=${MKOBJDIRS-yes}"
+	MAKEFLAGS="-de -m ${TOP}/share/mk ${MAKEFLAGS}"
 	export MAKEFLAGS MACHINE MACHINE_ARCH
 }

@@ -730,6 +730,7 @@
 	# Don't export them as they're only used for tests in build.sh.
 	#
 	MKOBJDIRS=$(getmakevar MKOBJDIRS)
+	MKOBJDIRS=${MKOBJDIRS-yes}
 	MKUNPRIVED=$(getmakevar MKUNPRIVED)
 	MKUPDATE=$(getmakevar MKUPDATE)

>Release-Note:
>Audit-Trail:
>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.