NetBSD Problem Report #39715

From www@NetBSD.org  Wed Oct  8 09:26:23 2008
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 6A02063BA54
	for <gnats-bugs@gnats.netbsd.org>; Wed,  8 Oct 2008 09:26:23 +0000 (UTC)
Message-Id: <20081008092623.1E7D163B88A@narn.NetBSD.org>
Date: Wed,  8 Oct 2008 09:26:23 +0000 (UTC)
From: cheusov@tut.by
Reply-To: cheusov@tut.by
To: gnats-bugs@NetBSD.org
Subject: bmake: bug in bsd.files.mk ?
X-Send-Pr-Version: www-1.0

>Number:         39715
>Category:       pkg
>Synopsis:       bmake: bug in bsd.files.mk ?
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    pkg-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Oct 08 09:30:00 +0000 2008
>Closed-Date:    Fri Jan 15 22:01:34 +0000 2010
>Last-Modified:  Fri Jan 15 22:05:02 +0000 2010
>Originator:     Aleksey Cheusov
>Release:        linux
>Organization:
home
>Environment:
Doesn't matter

>Description:
Typescript is below. FILES variable is probably reassigned
somewhere in bsd.files.mk.
MK scripts from bootstrap-mk-files are used.

NetBSD-4 make + NetBSD native mk scripts work just fine.

0 ~>cat Makefile 
FILES=          1 2 3 4 5
MORE_FILES=     6 7 8 9 0

.PHONY : print-vars
print-vars :
.for v in ${VARS}
        @printf "%s=%s\n" "${v}" "${${v}}"
.endfor

.include <bsd.files.mk>
0 ~>bmake print-vars VARS='FILES MORE_FILES'
FILES=
MORE_FILES=6 7 8 9 0
0 ~>

>How-To-Repeat:

>Fix:

>Release-Note:

>Audit-Trail:
From: Aleksey Cheusov <cheusov@tut.by>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/39715: bmake: bug in bsd.files.mk ?
Date: Wed, 08 Oct 2008 23:52:01 +0300

 --=-=-=

 I've found the following in bsd.files.mk

    # This file can be included multiple times.  It clears the definition of
    # FILES at the end so that this is possible.
    ...
    FILES:=

 Why this behaviour is bad?

 1) It breaks use of FILES variable in user's Makefiles.
 2) It breaks compatibility with other *BSD/makes/mk script, e.g.
     FreeBSD make.

 I propose the following patch


 --=-=-=
 Content-Type: text/x-patch
 Content-Disposition: inline; filename=bsd.files.mk.patch
 Content-Description: patch

 Index: files/bsd.files.mk
 ===================================================================
 RCS file: /cvsroot/pkgsrc/pkgtools/bootstrap-mk-files/files/bsd.files.mk,v
 retrieving revision 1.1.1.1
 diff -u -r1.1.1.1 bsd.files.mk
 --- files/bsd.files.mk	14 Jul 2006 23:13:00 -0000	1.1.1.1
 +++ files/bsd.files.mk	8 Oct 2008 20:48:43 -0000
 @@ -3,6 +3,9 @@
  # This file can be included multiple times.  It clears the definition of
  # FILES at the end so that this is possible.

 +.if !defined(_BSD_FILES_MK)
 +_BSD_FILES_MK:=	1
 +
  .PHONY:		filesinstall
  realinstall:	filesinstall

 @@ -37,4 +40,4 @@
  filesinstall::
  .endif

 -FILES:=
 +.endif # _BSD_FILES_MK

 --=-=-=


 -- 
 Best regards, Aleksey Cheusov.

 --=-=-=--

State-Changed-From-To: open->closed
State-Changed-By: abs@NetBSD.org
State-Changed-When: Fri, 15 Jan 2010 22:01:34 +0000
State-Changed-Why:
bootstrap-mk-files-20090807nb1 has the change


From: David Brownlee <abs@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/39715 CVS commit: pkgsrc/pkgtools/bootstrap-mk-files
Date: Fri, 15 Jan 2010 22:00:36 +0000

 Module Name:	pkgsrc
 Committed By:	abs
 Date:		Fri Jan 15 22:00:36 UTC 2010

 Modified Files:
 	pkgsrc/pkgtools/bootstrap-mk-files: Makefile
 	pkgsrc/pkgtools/bootstrap-mk-files/files: bsd.files.mk

 Log Message:
 Update bsd.files.mk multiple include protection to use the same mechanism
 as in the base NetBSD system - fixes PR pkg/39715


 To generate a diff of this commit:
 cvs rdiff -u -r1.23 -r1.24 pkgsrc/pkgtools/bootstrap-mk-files/Makefile
 cvs rdiff -u -r1.1.1.1 -r1.2 \
     pkgsrc/pkgtools/bootstrap-mk-files/files/bsd.files.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.