From owner-freebsd-bugs@FreeBSD.ORG Thu Dec 13 22:40:00 2012 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C16209B5 for ; Thu, 13 Dec 2012 22:40:00 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 94BBB8FC0C for ; Thu, 13 Dec 2012 22:40:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qBDMe0SF094003 for ; Thu, 13 Dec 2012 22:40:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qBDMe082094002; Thu, 13 Dec 2012 22:40:00 GMT (envelope-from gnats) Resent-Date: Thu, 13 Dec 2012 22:40:00 GMT Resent-Message-Id: <201212132240.qBDMe082094002@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, Kimmo Paasiala Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5E733780 for ; Thu, 13 Dec 2012 22:34:06 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id 2AB078FC16 for ; Thu, 13 Dec 2012 22:34:06 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qBDMY6ZI023785 for ; Thu, 13 Dec 2012 22:34:06 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id qBDMY6q0023784; Thu, 13 Dec 2012 22:34:06 GMT (envelope-from nobody) Message-Id: <201212132234.qBDMY6q0023784@red.freebsd.org> Date: Thu, 13 Dec 2012 22:34:06 GMT From: Kimmo Paasiala To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: misc/174422: usr/src/sys/conf/newvers.sh, SYSDIR set to wrong directory X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 13 Dec 2012 22:40:00 -0000 >Number: 174422 >Category: misc >Synopsis: usr/src/sys/conf/newvers.sh, SYSDIR set to wrong directory >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: Thu Dec 13 22:40:00 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Kimmo Paasiala >Release: 9-STABLE >Organization: >Environment: FreeBSD whitezone.rdnzl.info 9.1-PRERELEASE FreeBSD 9.1-PRERELEASE #0 r244185M: Thu Dec 13 23:08:38 EET 2012 root@whitezone.rdnzl.info:/usr/obj/usr/src/sys/RDNZL amd64 >Description: The newvers.sh script in /usr/src/sys/conf sets a wrong value to the SYSDIR variable when used from /usr/src/include/Makefile as part of the rule to create osreldate.h. The Makefile in /usr/src/include sources the newvers.sh instead of executing it, this causes the SYSDIR variable to be set to "/bin/.." instead of the intended "/usr/src/sys/conf/.." because "dirname $0" returns the dirname part of "/bin/sh" instead of dirname of "/usr/src/sys/conf/newvers.sh". This breaks at least the .git directory detection in newvers.sh if there happens to be a .git -directory in the root directory of the system. In such case builworld stops with an error at the .git directory detection. >How-To-Repeat: Create a git repository in the root directory with "git init" and attempt a "make buildworld" in /usr/src. >Fix: The attached patch should fix the problem. The fix tries to keep the newvers.sh compatible with other possible uses of it where it's not sourced by /usr/src/include/Makefile but executed directly. In a discussion on the freebsd-stable mailing list it was noted that misc/160646 should be commited before commiting this patch. Patch attached with submission follows: Index: include/Makefile =================================================================== --- include/Makefile (revision 244138) +++ include/Makefile (working copy) @@ -100,6 +100,7 @@ @${ECHO} creating osreldate.h from newvers.sh @MAKE=${MAKE}; \ PARAMFILE=${.CURDIR}/../sys/sys/param.h; \ + SYSDIR=${.CURDIR}/../sys; \ . ${.CURDIR}/../sys/conf/newvers.sh; \ echo "$$COPYRIGHT" > osreldate.h; \ echo "#ifdef _KERNEL" >> osreldate.h; \ Index: sys/conf/newvers.sh =================================================================== --- sys/conf/newvers.sh (revision 244138) +++ sys/conf/newvers.sh (working copy) @@ -38,7 +38,7 @@ fi RELEASE="${REVISION}-${BRANCH}" VERSION="${TYPE} ${RELEASE}" -SYSDIR=$(dirname $0)/.. +: ${SYSDIR:=$(dirname $0)/..} if [ "X${PARAMFILE}" != "X" ]; then RELDATE=$(awk '/__FreeBSD_version.*propagated to newvers/ {print $3}' \ >Release-Note: >Audit-Trail: >Unformatted: