Subject: pkg/8700: pkgsrc USE_LOCALBASE_FOR_X11 seems broken; recursive make lossage
To: None <gnats-bugs@gnats.netbsd.org>
From: None <cgd@NetBSD.ORG>
List: netbsd-bugs
Date: 10/29/1999 01:13:50
>Number:         8700
>Category:       pkg
>Synopsis:       pkgsrc USE_LOCALBASE_FOR_X11 drives make crazy
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    pkg-manager (NetBSD software packages system bug manager)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 29 00:50:59 1999
>Last-Modified:
>Originator:     Chris G. Demetriou
>Organization:
Kernel Hackers 'r' Us
>Release:        1.4-branch sources as described below, pkgsrc as of 19991029
>Environment:
System: NetBSD speedy.int.demetriou.com 1.4.1 NetBSD 1.4.1 (SPEEDY) #16: Tue Sep 21 23:35:27 PDT 1999     cgd@speedy.int.demetriou.com:/a/src/src-1-4-branch/sys/arch/i386/compile/SPEEDY i386
(but it's really a 1.4-branch current system with kernel built from
sources of that date and userland built from about 19991019 sources.)

>Description:
	'make' or other commands (e.g. make fetch) in pkgsrc's x11-using
	packages, with USE_LOCALBASE_FOR_X11 set, seems to cause 'make'
	to be invoked recursively until there aren't any more processes
	to be had.  This is with pkgsrc updated to 19991029 sources.

	I'd used the same mk.conf configuration (including
	USE_LOCALBASE_FOR_X11) with the 1.4 pkgsrc, which was I think
	the last time I built.  (USE_LOCALBASE_FOR_X11 didn't work then,
	so xpkgwedge wasn't an issue.)

	This caused the crash reported in PR#8699, so i consider it
	really serious.  8-)

>How-To-Repeat:
	'make' an X11 pkg in pkgsrc w/ USE_LOCALBASE_FOR_X11 set and
	without xpkgwedge being installed.

	make in xpkgwedge itself produces the same result.

>Fix:
	The diff below seems to do the right thing, but i'm no pkgsrc guru.
	(It told me to upgrade my pkgtools from the 1999/04/12-ish version
	installed, and then when i did that could make fetch and make...)

Index: mk/bsd.pkg.mk
===================================================================
RCS file: /cvsroot/pkgsrc/mk/bsd.pkg.mk,v
retrieving revision 1.361
diff -c -r1.361 bsd.pkg.mk
*** bsd.pkg.mk	1999/10/22 14:14:22	1.361
--- bsd.pkg.mk	1999/10/29 07:44:39
***************
*** 76,82 ****
  PKGDIR?=		${.CURDIR}/pkg
  
  .if defined(USE_IMAKE) || defined(USE_MOTIF) || defined(USE_X11BASE)
! .if defined(USE_LOCALBASE_FOR_X11)
  PREFIX=			${LOCALBASE}
  BUILD_DEPENDS+=		${X11BASE}/lib/X11/config/xpkgwedge.def:${PKGSRCDIR}/pkgtools/xpkgwedge
  .else
--- 76,82 ----
  PKGDIR?=		${.CURDIR}/pkg
  
  .if defined(USE_IMAKE) || defined(USE_MOTIF) || defined(USE_X11BASE)
! .if defined(USE_LOCALBASE_FOR_X11) && !defined(XPKGWEDGE_INTERNAL)
  PREFIX=			${LOCALBASE}
  BUILD_DEPENDS+=		${X11BASE}/lib/X11/config/xpkgwedge.def:${PKGSRCDIR}/pkgtools/xpkgwedge
  .else
Index: pkgtools/xpkgwedge/Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/pkgtools/xpkgwedge/Makefile,v
retrieving revision 1.12
diff -c -r1.12 Makefile
*** Makefile	1998/09/27 18:38:30	1.12
--- Makefile	1999/10/29 07:44:39
***************
*** 14,19 ****
--- 14,22 ----
  
  MESSAGE_FILE=	${WRKDIR}/MESSAGE
  
+ # This is xpkgwedge, it mucks with the internals of the pkg mk bits.
+ XPKGWEDGE_INTERNAL=
+ 
  pre-extract:
  	@if [ ! -f ${X11BASE}/include/X11/X.h ]; then \
  		${ECHO} 'xpkgwedge requires $$X11BASE to point to the real X distribution.'; \
***************
*** 30,40 ****
  		> ${MESSAGE_FILE}
  
  .include "../../mk/bsd.pkg.mk"
- 
- # In order to force xpkgwedge to install into X11BASE, we forcibly override
- # any user setting of USE_LOCALBASE_FOR_X11.  _NO_ other pkg should do this.
- PREFIX=${X11BASE}
- 
- # Clear the build dependencies list so that xpkgwedge will not be recursively
- # dependent on itself.
- BUILD_DEPENDS=
--- 33,35 ----
>Audit-Trail:
>Unformatted: