NetBSD Problem Report #59184

From www@netbsd.org  Mon Mar 17 01:21:49 2025
Return-Path: <www@netbsd.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256
	 client-signature RSA-PSS (2048 bits) client-digest SHA256)
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id C35721A9239
	for <gnats-bugs@gnats.NetBSD.org>; Mon, 17 Mar 2025 01:21:49 +0000 (UTC)
Message-Id: <20250317012148.72D201A923C@mollari.NetBSD.org>
Date: Mon, 17 Mar 2025 01:21:48 +0000 (UTC)
From: campbell+netbsd@mumble.net
Reply-To: campbell+netbsd@mumble.net
To: gnats-bugs@NetBSD.org
Subject: devel/mk-configure fails with mysterious .MAKE.LEVEL.ENV error
X-Send-Pr-Version: www-1.0

>Number:         59184
>Category:       pkg
>Synopsis:       devel/mk-configure fails with mysterious .MAKE.LEVEL.ENV error
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    rillig
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Mar 17 01:25:00 +0000 2025
>Closed-Date:    Sun Mar 23 18:57:14 +0000 2025
>Last-Modified:  Wed Mar 26 20:30:01 +0000 2025
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The NetMK Configuration
>Environment:
>Description:
Bulk builds of devel/mk-configure have been intermittently failing since around the time of the bmake-20240909 update on 2024-09-17:

https://releng.netbsd.org/bulktracker/devel/mk-configure

Example build output, essentially identical in all the failures:

===> Building for mk-configure-0.40.0
bmake: Cannot delete ".MAKE.LEVEL.ENV" as it is read-only
bmake: Fatal errors encountered -- cannot continue
bmake: stopped making "all all-doc" in /pbulk/work/devel/mk-configure/work/mk-configure-0.40.0
*** Error code 1
>How-To-Repeat:
I have not been able to reproduce this.

I don't understand make(1) well enough to understand how .MAKE.LEVEL.ENV turns up at all -- it doesn't appear in the devel/mk-configure source code, or anywhere under mk/.  It appears to come out of make(1) itself:

$ make -v MAKEFLAGS -v .MAKE.LEVEL.ENV

MAKELEVEL
$ printf 'x: .PHONY;@${MAKE} -v MAKEFLAGS -v .MAKE.LEVEL.ENV' | make -f /dev/stdin
 .MAKE.LEVEL.ENV=MAKELEVEL
MAKELEVEL

So I assume it is something to do with recursive make invocations passing variables through the environment, perhaps via MAKEFLAGS.  But this is pretty mysterious, and I don't understand why it succeeds in some builds but fails in others.
>Fix:
Yes, please!

>Release-Note:

>Audit-Trail:
From: Thomas Klausner <wiz@gatalith.at>
To: NetBSD bugtracking <gnats-bugs@NetBSD.org>
Cc: Roland Illig <rillig@NetBSD.org>
Subject: Re: pkg/59184: devel/mk-configure fails with mysterious
 .MAKE.LEVEL.ENV error
Date: Mon, 17 Mar 2025 08:32:37 +0100

 I asked rillig@ this last fall, and his analysis is, in my words:

 Since usr.bin/make from 2020-08-22, internal variables that are
 provided over the command line, are not put into MAKEFLAGS into
 longer.

 NetBSD 9 doesn't have this patch.

 mk-configure pulls in bmake from pkgsrc (with this change). The build
 is started using NetBSD 9's make, which exports the (internal)
 MAKEFLAGS variable and calls bmake-20240711, which complains about the
 try of overwriting the internal variable.

 If I got it wrong, I hope rillig will correct me :)
  Thomas

From: Benny Siegert <bsiegert@gmail.com>
To: gnats-bugs@netbsd.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org, campbell+netbsd@mumble.net,
 Aleksey Cheusov <vle@gmx.net>
Cc: 
Subject: Re: pkg/59184: devel/mk-configure fails with mysterious
 .MAKE.LEVEL.ENV error
Date: Mon, 17 Mar 2025 20:47:47 +0100

 Am 17.03.25 um 08:35 schrieb Thomas Klausner via gnats:
 >   I asked rillig@ this last fall, and his analysis is, in my words:
 >   
 >   Since usr.bin/make from 2020-08-22, internal variables that are
 >   provided over the command line, are not put into MAKEFLAGS into
 >   longer.
 >   
 >   NetBSD 9 doesn't have this patch.
 >   
 >   mk-configure pulls in bmake from pkgsrc (with this change). The build
 >   is started using NetBSD 9's make, which exports the (internal)
 >   MAKEFLAGS variable and calls bmake-20240711, which complains about the
 >   try of overwriting the internal variable.

 I also emailed cheusov@ about this a while ago. He said he would look 
 into it.

 -- 
 Benny

Responsible-Changed-From-To: pkg-manager->cheusov
Responsible-Changed-By: bsiegert@NetBSD.org
Responsible-Changed-When: Mon, 17 Mar 2025 19:53:11 +0000
Responsible-Changed-Why:
Over to author / maintainer


From: Taylor R Campbell <riastradh@NetBSD.org>
To: Thomas Klausner <wiz@gatalith.at>
Cc: gnats-bugs@netbsd.org, pkg-manager@netbsd.org, gnats-admin@netbsd.org,
	pkgsrc-bugs@netbsd.org
Subject: Re: pkg/59184: devel/mk-configure fails with mysterious
	.MAKE.LEVEL.ENV error
Date: Mon, 17 Mar 2025 20:09:23 +0000

 > Date: Mon, 17 Mar 2025 08:32:37 +0100
 > From: Thomas Klausner <wiz@gatalith.at>
 >
 > I asked rillig@ this last fall, and his analysis is, in my words:
 >  
 > Since usr.bin/make from 2020-08-22, internal variables that are
 > provided over the command line, are not put into MAKEFLAGS into
 > longer.
 > 
 > NetBSD 9 doesn't have this patch.
 > 
 > mk-configure pulls in bmake from pkgsrc (with this change). The build
 > is started using NetBSD 9's make, which exports the (internal)
 > MAKEFLAGS variable and calls bmake-20240711, which complains about the
 > try of overwriting the internal variable.

 Can we do something to nix .MAKE.LEVEL.ENV from the MAKEFLAGS that
 pkgsrc passes down to the do-build recipe?

 It sounds like it's not really mk-configure's fault that this is
 happening; really, it's a bug with pkgsrc running a do-build recipe
 the wrong way -- in a way the package Makefile didn't even ask for.

Responsible-Changed-From-To: cheusov->rillig
Responsible-Changed-By: riastradh@NetBSD.org
Responsible-Changed-When: Sat, 22 Mar 2025 02:06:20 +0000
Responsible-Changed-Why:
Can I trouble you to suggest a workaround, either for
(a) devel/mk-configure to use in its own makefile, or
(b) for pkgsrc to set generally (after the freeze), or
(c) for devel/bmake to handle being run by older make(1)?


From: "Roland Illig" <rillig@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59184 CVS commit: src/usr.bin/make
Date: Sat, 22 Mar 2025 12:23:00 +0000

 Module Name:	src
 Committed By:	rillig
 Date:		Sat Mar 22 12:23:00 UTC 2025

 Modified Files:
 	src/usr.bin/make: var.c
 	src/usr.bin/make/unit-tests: varname-dot-make-level.exp
 	    varname-dot-make-level.mk

 Log Message:
 make: ignore attempts to override a read-only global with the same value

 Up to NetBSD 9, make passed around the internal variable .MAKE.LEVEL.ENV
 via MAKEFLAGS. Allow these old versions of make to coexist with newer
 versions of make. See unit-tests/varname-dot-make-level.mk for details.

 Fixes PR pkg/59184.


 To generate a diff of this commit:
 cvs rdiff -u -r1.1144 -r1.1145 src/usr.bin/make/var.c
 cvs rdiff -u -r1.4 -r1.5 \
     src/usr.bin/make/unit-tests/varname-dot-make-level.exp
 cvs rdiff -u -r1.5 -r1.6 \
     src/usr.bin/make/unit-tests/varname-dot-make-level.mk

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

From: Roland Illig <roland.illig@gmx.de>
To: gnats-bugs@netbsd.org, rillig@netbsd.org, gnats-admin@netbsd.org,
 pkgsrc-bugs@netbsd.org, campbell+netbsd@mumble.net,
 Simon Gerraty <sjg@crufty.net>, Jonathan Perkin <jperkin@mnx.io>
Cc: 
Subject: Re: PR/59184 CVS commit: src/usr.bin/make
Date: Sat, 22 Mar 2025 15:37:01 +0100

 Am 22.03.2025 um 13:25 schrieb Roland Illig:
 >  Modified Files:
 >  	src/usr.bin/make: var.c
 >  	src/usr.bin/make/unit-tests: varname-dot-make-level.exp
 >  	    varname-dot-make-level.mk
 >
 >  Fixes PR pkg/59184.

 The next step is for Simon to prepare a new bmake release, which usually
 happens within one week.

 Then, Jonathan can test the new bmake release in a bulk build, to ensure
 that nothing gets broken since bmake-20240909. The notable changes
 between these versions are:

 - In parallel mode, an error in one job doesn't abruptly abort the other
 jobs anymore, instead they are finished and cleaned up properly.

 - Instead of "Malformed conditional", the error message is now "Variable
 %s is undefined" where appropriate.

 Roland

From: Simon Gerraty <sjg@crufty.net>
To: Roland Illig <roland.illig@gmx.de>
Cc: gnats-bugs@netbsd.org, rillig@netbsd.org, gnats-admin@netbsd.org,
	pkgsrc-bugs@netbsd.org, campbell+netbsd@mumble.net,
	Jonathan Perkin <jperkin@mnx.io>, sjg@crufty.net
Subject: Re: PR/59184 CVS commit: src/usr.bin/make
Date: Sat, 22 Mar 2025 08:49:15 -0700

 FWIW I think .MAKE.LEVEL.ENV could probably go away,
 AFAIK it has never proven necessary.

 On Sat, 22 Mar 2025 15:37:01 +0100, Roland Illig writes:
 >Am 22.03.2025 um 13:25 schrieb Roland Illig:
 >>  Modified Files:
 >>  	src/usr.bin/make: var.c
 >>  	src/usr.bin/make/unit-tests: varname-dot-make-level.exp
 >>  	    varname-dot-make-level.mk
 >>
 >>  Fixes PR pkg/59184.
 >
 >The next step is for Simon to prepare a new bmake release, which usually
 >happens within one week.
 >
 >Then, Jonathan can test the new bmake release in a bulk build, to ensure
 >that nothing gets broken since bmake-20240909. The notable changes
 >between these versions are:
 >
 >- In parallel mode, an error in one job doesn't abruptly abort the other
 >jobs anymore, instead they are finished and cleaned up properly.
 >
 >- Instead of "Malformed conditional", the error message is now "Variable
 >%s is undefined" where appropriate.
 >
 >Roland

From: Simon Gerraty <sjg@crufty.net>
To: Roland Illig <roland.illig@gmx.de>
Cc: gnats-bugs@netbsd.org, rillig@netbsd.org, gnats-admin@netbsd.org,
	pkgsrc-bugs@netbsd.org, campbell+netbsd@mumble.net,
	Jonathan Perkin <jperkin@mnx.io>, sjg@crufty.net
Subject: Re: PR/59184 CVS commit: src/usr.bin/make
Date: Sun, 23 Mar 2025 10:11:47 -0700

 I normally sit on a bmake release candidate for several days - where it
 gets used in 100's of builds at work on various systems.

 However if someone is in a hurry to test the next steps,
 a beta is available at

 https://www.crufty.net/ftp/pub/sjg/beta/bmake-20250323.tar.gz

 with the usual signatures etc.  Note it will be removed when the next
 release actually happens.

 On Sat, 22 Mar 2025 15:37:01 +0100, Roland Illig writes:
 >Am 22.03.2025 um 13:25 schrieb Roland Illig:
 >>  Modified Files:
 >>  	src/usr.bin/make: var.c
 >>  	src/usr.bin/make/unit-tests: varname-dot-make-level.exp
 >>  	    varname-dot-make-level.mk
 >>
 >>  Fixes PR pkg/59184.
 >
 >The next step is for Simon to prepare a new bmake release, which usually
 >happens within one week.
 >
 >Then, Jonathan can test the new bmake release in a bulk build, to ensure
 >that nothing gets broken since bmake-20240909. The notable changes
 >between these versions are:
 >
 >- In parallel mode, an error in one job doesn't abruptly abort the other
 >jobs anymore, instead they are finished and cleaned up properly.
 >
 >- Instead of "Malformed conditional", the error message is now "Variable
 >%s is undefined" where appropriate.
 >
 >Roland

From: "Roland Illig" <rillig@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59184 CVS commit: pkgsrc/devel/mk-configure
Date: Sun, 23 Mar 2025 18:41:05 +0000

 Module Name:	pkgsrc
 Committed By:	rillig
 Date:		Sun Mar 23 18:41:05 UTC 2025

 Modified Files:
 	pkgsrc/devel/mk-configure: Makefile

 Log Message:
 devel/mk-configure: fix build on NetBSD 9

 No binary change to the package on other platforms, thus no PKGREVISION
 bump.

 Fixes PR pkg/59184.


 To generate a diff of this commit:
 cvs rdiff -u -r1.48 -r1.49 pkgsrc/devel/mk-configure/Makefile

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

State-Changed-From-To: open->closed
State-Changed-By: rillig@NetBSD.org
State-Changed-When: Sun, 23 Mar 2025 18:57:14 +0000
State-Changed-Why:
Fixed for NetBSD 9.


From: Roland Illig <roland.illig@gmx.de>
To: gnats-bugs@netbsd.org, rillig@netbsd.org, pkgsrc-bugs@netbsd.org,
 gnats-admin@netbsd.org, campbell+netbsd@mumble.net,
 Simon Gerraty <sjg@crufty.net>
Cc: 
Subject: Re: pkg/59184 (devel/mk-configure fails with mysterious
 .MAKE.LEVEL.ENV error)
Date: Sun, 23 Mar 2025 20:07:54 +0100

 Am 23.03.2025 um 19:57 schrieb rillig@NetBSD.org:
 > Synopsis: devel/mk-configure fails with mysterious .MAKE.LEVEL.ENV error
 >
 > State-Changed-From-To: open->closed
 > State-Changed-By: rillig@NetBSD.org
 > State-Changed-When: Sun, 23 Mar 2025 18:57:14 +0000
 > State-Changed-Why:
 > Fixed for NetBSD 9.

 No need to hurry anymore. I fixed the package, just before the quarterly
 branch, and tested it on NetBSD 9 and 10. For now, no further changes
 are needed.

 Roland

From: "Roland Illig" <rillig@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/59184 CVS commit: pkgsrc/devel/mk-configure
Date: Wed, 26 Mar 2025 20:26:26 +0000

 Module Name:	pkgsrc
 Committed By:	rillig
 Date:		Wed Mar 26 20:26:26 UTC 2025

 Modified Files:
 	pkgsrc/devel/mk-configure: mk-c.mk

 Log Message:
 devel/mk-configure: fix NetBSD-9 build for packages using mk-configure

 See PR pkg/59184.


 To generate a diff of this commit:
 cvs rdiff -u -r1.11 -r1.12 pkgsrc/devel/mk-configure/mk-c.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.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.