From owner-freebsd-arch@FreeBSD.ORG Tue Aug 28 02:13:05 2007 Return-Path: Delivered-To: arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAAFD16A47A; Tue, 28 Aug 2007 02:13:05 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (comp.chem.msu.su [158.250.32.97]) by mx1.freebsd.org (Postfix) with ESMTP id D0E4B13C469; Tue, 28 Aug 2007 02:13:04 +0000 (UTC) (envelope-from yar@comp.chem.msu.su) Received: from comp.chem.msu.su (localhost [127.0.0.1]) by comp.chem.msu.su (8.13.4/8.13.4) with ESMTP id l7S1lo1U084215; Tue, 28 Aug 2007 05:47:50 +0400 (MSD) (envelope-from yar@comp.chem.msu.su) Received: (from yar@localhost) by comp.chem.msu.su (8.13.4/8.13.4/Submit) id l7S1lnqX084214; Tue, 28 Aug 2007 05:47:50 +0400 (MSD) (envelope-from yar) Date: Tue, 28 Aug 2007 05:47:49 +0400 From: Yar Tikhiy To: arch@freebsd.org Message-ID: <20070828014748.GV21352@comp.chem.msu.su> References: <20070824.172212.74696955.imp@bsdimp.com> <20070824.213615.146406398.imp@bsdimp.com> <20070828005654.GA50401@dragon.NUXI.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070828005654.GA50401@dragon.NUXI.org> User-Agent: Mutt/1.5.9i Cc: deischen@freebsd.org Subject: ABI and install tools (was Re: cvs commit: src/lib/libc/gen fts-compat.c fts-compat.h) X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Aug 2007 02:13:05 -0000 [Redirecting this branch to -arch] On Mon, Aug 27, 2007 at 05:56:54PM -0700, David O'Brien wrote: > On Fri, Aug 24, 2007 at 09:36:15PM -0600, M. Warner Losh wrote: > > In message: > > Daniel Eischen writes: > > : I guess the build system should be more tolerant of this, but > > : there are bound to be problems regardless. I don't see why > > : the install tools can't also either have their own set of > > : libraries (utilizing LD_LIBRARY_PATH) or be built static. > > > > There's much resistance to building everything that the build system > > might be used being build static. It adds too much time and > > complexity to the build system, the opponents say. > > I've never heard an argument against building these bits static. > What's the issue? FWIW, here's a patch implementing the opposite approach: If we're going to install world over this system (installworld with DESTDIR unset or empty), first install the new versions of necessary tools to a scratch directory and then switch to the new tools. The kernel must be capable of running the new tools with the new libraries, which is an already existing requirement. With the patch, the build system can tolerate ABI breakage in libc and, according to audit(4), it runs no binaries from the old system in the sensitive part of installworld. For easier and safer testing, INSTALL_TESTING can be set so that the new way is chosen even if DESTDIR is set. Of course, make sure that the new tools are for the same platform as the machine runs. Usually you cannot select a different platform w/o setting DESTDIR. Comments are welcome. Thanks! -- Yar Index: Makefile.inc1 =================================================================== RCS file: /home/ncvs/src/Makefile.inc1,v retrieving revision 1.584 diff -u -r1.584 Makefile.inc1 --- Makefile.inc1 10 Jul 2007 10:19:45 -0000 1.584 +++ Makefile.inc1 28 Aug 2007 01:15:28 -0000 @@ -159,7 +159,14 @@ STRICTTMPPATH= ${BPATH}:${XPATH} TMPPATH= ${STRICTTMPPATH}:${PATH} +# +# Avoid running mktemp(1) unless actually needed. +# It may not be functional, e.g., due to new ABI +# when in the middle of installing over this system. +# +.if make(installworld) || make(distributeworld) INSTALLTMP!= /usr/bin/mktemp -d -u -t install +.endif # # Building a world goes through the following stages @@ -265,12 +272,11 @@ .endif # install stage +IMAKEENV= ${CROSSENV} ${INSTALLENV} .if empty(.MAKEFLAGS:M-n) -IMAKEENV= ${CROSSENV} \ - PATH=${STRICTTMPPATH}:${INSTALLTMP} +IMAKEENV+= PATH=${STRICTTMPPATH}:${INSTALLTMPPATH} .else -IMAKEENV= ${CROSSENV} \ - PATH=${TMPPATH}:${INSTALLTMP} +IMAKEENV+= PATH=${TMPPATH}:${INSTALLTMPPATH} .endif IMAKE= ${IMAKEENV} ${MAKE} -f Makefile.inc1 @@ -567,6 +573,50 @@ .endfor # +# If installing over this system, use the newly built tools +# to avoid such complications as the requirement of ABI compatibility +# between the old tools and the new libraries. +# +.if make(installworld) && (empty(DESTDIR) || defined(INSTALL_TESTING)) +INSTALLPATH= /sbin:/bin:/usr/sbin:/usr/bin +INSTALLTMPPATH= ${INSTALLPATH:S/^/${INSTALLTMP}/:S/:/:${INSTALLTMP}/g} + +INSTALLENV= LD_LIBRARY_PATH=${WORLDTMP}/lib:${WORLDTMP}/usr/lib +INSTALLENV+= __MAKE_SHELL=${INSTALLTMP}/bin/sh + +INSTALLTOOLS= \ + bin/cat \ + bin/chflags \ + bin/chmod \ + bin/date \ + bin/echo \ + bin/ln \ + bin/mkdir \ + bin/mv \ + bin/rm \ + bin/sh \ + bin/test \ + gnu/usr.bin/grep \ + gnu/usr.bin/texinfo/install-info \ + sbin/sysctl \ + usr.bin/awk \ + usr.bin/cap_mkdb \ + usr.bin/find \ + usr.bin/lockf \ + usr.bin/make \ + usr.bin/sed \ + usr.bin/true \ + usr.bin/uname \ + usr.bin/wc \ + usr.sbin/chown \ + usr.sbin/mtree \ + usr.sbin/pwd_mkdb \ + usr.sbin/zic/zic +.else +INSTALLTMPPATH=${INSTALLTMP} +.endif + +# # distributeworld # # Distributes everything compiled by a `buildworld'. @@ -576,6 +626,15 @@ # Installs everything compiled by a 'buildworld'. # distributeworld installworld: installcheck +.if make(installworld) && (empty(DESTDIR) || defined(INSTALL_TESTING)) + mkdir -p ${INSTALLTMPPATH:S/:/ /g} +.for _tool in ${INSTALLTOOLS} + cd ${.CURDIR}/${_tool}; \ + ${MAKE} -DWITHOUT_INFO -DWITHOUT_MAN \ + DESTDIR=${INSTALLTMP} INSTALL="sh ${.CURDIR}/tools/install.sh" \ + install +.endfor +.else mkdir -p ${INSTALLTMP} for prog in [ awk cap_mkdb cat chflags chmod chown \ date echo egrep find grep install-info \ @@ -583,6 +642,7 @@ test true uname wc zic; do \ cp `which $$prog` ${INSTALLTMP}; \ done +.endif ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//} rm -rf ${INSTALLTMP} Index: share/mk/sys.mk =================================================================== RCS file: /home/ncvs/src/share/mk/sys.mk,v retrieving revision 1.92 diff -u -r1.92 sys.mk --- share/mk/sys.mk 14 Aug 2007 13:44:08 -0000 1.92 +++ share/mk/sys.mk 27 Aug 2007 16:29:08 -0000 @@ -256,6 +256,11 @@ .include "${__MAKE_CONF}" .endif +.if !empty(__MAKE_SHELL) +SHELL= ${__MAKE_SHELL} +.SHELL: path=${__MAKE_SHELL} +.endif + # Default executable format # XXX hint for bsd.port.mk OBJFORMAT?= elf