From owner-freebsd-bugs@FreeBSD.ORG Sun Jan 5 03:20:00 2014 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id AECC7F37 for ; Sun, 5 Jan 2014 03:20:00 +0000 (UTC) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8A5141A03 for ; Sun, 5 Jan 2014 03:20:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.7/8.14.7) with ESMTP id s053K0G1067621 for ; Sun, 5 Jan 2014 03:20:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.7/8.14.7/Submit) id s053K0iX067620; Sun, 5 Jan 2014 03:20:00 GMT (envelope-from gnats) Resent-Date: Sun, 5 Jan 2014 03:20:00 GMT Resent-Message-Id: <201401050320.s053K0iX067620@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Nathan Dorfman Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 88166CC0 for ; Sun, 5 Jan 2014 03:15:34 +0000 (UTC) Received: from oldred.freebsd.org (oldred.freebsd.org [IPv6:2001:1900:2254:206a::50:4]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 72E0B19CD for ; Sun, 5 Jan 2014 03:15:34 +0000 (UTC) Received: from oldred.freebsd.org ([127.0.1.6]) by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id s053FYBv000949 for ; Sun, 5 Jan 2014 03:15:34 GMT (envelope-from nobody@oldred.freebsd.org) Received: (from nobody@localhost) by oldred.freebsd.org (8.14.5/8.14.5/Submit) id s053FYjQ000941; Sun, 5 Jan 2014 03:15:34 GMT (envelope-from nobody) Message-Id: <201401050315.s053FYjQ000941@oldred.freebsd.org> Date: Sun, 5 Jan 2014 03:15:34 GMT From: Nathan Dorfman To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/185480: WORLDTMP first in PATH during installworld X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Jan 2014 03:20:00 -0000 >Number: 185480 >Category: misc >Synopsis: WORLDTMP first in PATH during installworld >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sun Jan 05 03:20:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Nathan Dorfman >Release: 10.0-RC4 r260251 >Organization: >Environment: FreeBSD server 10.0-RC4 FreeBSD 10.0-RC4 #0 r260251: Sat Jan 4 15:48:21 EST 2014 na@server:/mnt/obj/usr/src/sys/GENERIC amd64 FreeBSD hudson 10.0-RC4 FreeBSD 10.0-RC4 #0 r260251: Sat Jan 4 18:18:03 EST 2014 na@client:/mnt/obj/mips.mips64/usr/src/sys/ERL mips >Description: Disclaimer: I don't know much about this stuff, but after posting it here: http://lists.freebsd.org/pipermail/freebsd-mips/2014-January/003227.html I was asked to submit a PR, so here it is. This only causes failures if one tries to installworld on a different platform than buildworld was run on, but I suspect it may be silently hiding unintentional behavior in the other, more usual cases. The various subdirs of WORLDTMP (bin, usr/bin, usr/sbin, and so on) are the first elements of PATH during installkernel/installworld. Is this intentional? A couple of things suggest maybe not. The first is that WORLDTMP contains a toolchain for MACHINE_ARCH, even if you are cross-compiling by setting TARGET_ARCH. So, if you later try to install the crossbuilt kernel/world on the TARGET_ARCH machine, it will try to execute binaries built for the build machine, and fail: cc: Exec format error make[2]: "/usr/src/share/mk/bsd.compiler.mk" line 9: warning: "cc --version" returned non-zero status This is easily remedied by either deleting WORLDTMP between build and install, or changing its definition in Makefile.inc1 to include ${MACHINE_ARCH} in the name before buildworld, so it won't be found by an installworld with a different MACHINE_ARCH. I'm not sure this is the right fix, though, as it leaves installkernel/world with only the existing installed root (/bin, /usr/bin, ...) in its PATH. The second one is a bit more glaringly obvious. After the above workaround is used, installworld fails a little later: install -s -o root -g wheel -m 444 -fschg -S libc.so.7 /lib install: exec(strip): No such file or directory The PATH here again begins with the root at WORLDTMP, but ends not with the system root but /tmp/install.3aqj2XwQ. I noticed that installworld had just created this directory, and simply neglected to put strip in it, easily fixed by adding strip to the list of ITOOLS= in Makefile.inc1. However, under normal circumstances, nothing in this new directory is ever used, since everything is found in WORLDTMP first. Can that be right? We just went through the trouble of creating and populating a directory we don't intend to use? It seemed more likely that the intent is to use it, and that WORLDTMP is first in the PATH by mistake. >How-To-Repeat: server# uname -m amd64 server# cd /usr/src && svn diff && svn info | egrep '^URL|Revision' URL: svn://svn0.us-east.freebsd.org/base/releng/10.0 Revision: 260251 server# export MAKEOBJDIRPREFIX=/mnt/obj server# rm -rf $MAKEOBJDIRPREFIX server# TARGET=mips TARGET=mips64 make KERNCONF=ERL buildworld buildkernel client# uname -m mips client# mount | grep /usr server:/usr/src on /usr/src (nfs, read-only) server:/mnt/obj/mips.mips64 on /usr/obj (nfs, read-only) client# cd /usr/src && make KERNCONF=ERL installkernel installworld >Fix: If it's intentional that WORLDTMP is first in the PATH, then: 1. why are we bothering to build IROOT? 2. can it at least be redefined to include ${MACHINE_ARCH} in the name, so it won't break later installs run on a different arch? 3. if this is to be fully supported, then I guess a version of WORLDTMP needs to be compiled for the TARGET_ARCH as well when cross-building. If it isn't intentional... well. I guess it's a lot simpler then. :) >Release-Note: >Audit-Trail: >Unformatted: