From owner-svn-src-all@FreeBSD.ORG Tue Aug 13 15:32:26 2013 Return-Path: Delivered-To: svn-src-all@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 ESMTP id 877653D0; Tue, 13 Aug 2013 15:32:26 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mail0.glenbarber.us (mail0.glenbarber.us [208.86.227.67]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3F0FF2F54; Tue, 13 Aug 2013 15:32:25 +0000 (UTC) Received: from glenbarber.us (nucleus.glenbarber.us [IPv6:2001:470:8:1205:2:2:ff:29]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) (Authenticated sender: gjb) by mail0.glenbarber.us (Postfix) with ESMTPSA id 2E2C8DE99; Tue, 13 Aug 2013 15:32:24 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.8.3 mail0.glenbarber.us 2E2C8DE99 Authentication-Results: mail0.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Tue, 13 Aug 2013 11:32:22 -0400 From: Glen Barber To: Ian Lepore Subject: Re: svn commit: r254217 - head/sys/conf Message-ID: <20130813153222.GL2432@glenbarber.us> References: <201308111357.r7BDvF7H065442@svn.freebsd.org> <1376407389.3320.209.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="eUGqGfkt69yEwRle" Content-Disposition: inline In-Reply-To: <1376407389.3320.209.camel@revolution.hippie.lan> X-Operating-System: FreeBSD 10.0-CURRENT amd64 User-Agent: Mutt/1.5.21 (2010-09-15) Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Aug 2013 15:32:26 -0000 --eUGqGfkt69yEwRle Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 13, 2013 at 09:23:09AM -0600, Ian Lepore wrote: > On Sun, 2013-08-11 at 13:57 +0000, Glen Barber wrote: > > Author: gjb > > Date: Sun Aug 11 13:57:14 2013 > > New Revision: 254217 > > URL: http://svnweb.freebsd.org/changeset/base/254217 > >=20 > > Log: > > Use realpath(1) to determine the location of the newvers.sh script, > > since the current working directory might not be what is expected, > > causing svn{,lite}version to fail to find ${0} (itself). > > =20 > > Submitted by: Dan Mack > >=20 > > Modified: > > head/sys/conf/newvers.sh > >=20 > > Modified: head/sys/conf/newvers.sh > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > --- head/sys/conf/newvers.sh Sun Aug 11 11:33:48 2013 (r254216) > > +++ head/sys/conf/newvers.sh Sun Aug 11 13:57:14 2013 (r254217) > > @@ -96,7 +96,7 @@ for dir in /usr/bin /usr/local/bin; do > > # Run svnversion from ${dir} on this script; if return code > > # is not zero, the checkout might not be compatible with the > > # svnversion being used. > > - ${dir}/svnversion $(basename ${0}) >/dev/null 2>&1 > > + ${dir}/svnversion $(realpath ${0}) >/dev/null 2>&1 > > if [ $? -eq 0 ]; then > > svnversion=3D${dir}/svnversion > > break > > @@ -105,7 +105,7 @@ for dir in /usr/bin /usr/local/bin; do > > done > > =20 > > if [ -z "${svnversion}" ] && [ -x /usr/bin/svnliteversion ] ; then > > - /usr/bin/svnliteversion $(basename ${0}) >/dev/null 2>&1 > > + /usr/bin/svnliteversion $(realpath ${0}) >/dev/null 2>&1 > > if [ $? -eq 0 ]; then > > svnversion=3D/usr/bin/svnliteversion > > else >=20 > This is still not working for me. I don't see how it could be working > properly for anyone. >=20 > The newvers.sh isn't run from the make rules, it's sourced into the > rules. In that context, ${0} appears to resolve to simply "sh" or > "/bin/sh" (depending on host OS version) not the name of the script that > was sourced. Here's a minimal example: >=20 > root@wand:/tmp # cat /tmp/foo > #!/bin/sh - > echo ${0} > =20 > root@wand:/tmp # cat /tmp/Makefile=20 > all: > @echo "Sourcing /tmp/foo..."; \ > . /tmp/foo > =20 > root@wand:/tmp # make > Sourcing /tmp/foo... > /bin/sh >=20 > There are other references to $0 within newvers.sh, and if you add a > 'set -x' to the beginning of the script you can see that they all > resolve to /bin/sh, which seems to imply that there's some stuff that's > working by accident in that script when it's sourced in. >=20 I tested this with a 'buildkernel', not running the script directly. In my tests, I did add 'set -x' so I could verify the right thing was being done, which in my case, it was. Can you 'set -x' in the script, and provide the output of 'make -s builkdkernel' ? Glen --eUGqGfkt69yEwRle Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJSClGGAAoJEFJPDDeguUajgjcH/3+cjWxs/3n3VXeMC0Spe+kD 6/fj7AxND6dwZnEYdHcexlIx3CePyNRBtqitr2izrmmg+ya+q60uPUMKc7qbTkFJ GVJeBfZQ04WSe1r5u13mFeYaxST29fHXGp+RxGrCVngRWD6zvzTox29RzCfxx0kx N2c030GMwXg0sdmqfE5jIFlG6BLfRDqAm+/d3B5eU9SQMCacamKKJw/enhdeHzWm GjuhmkHfQ/OqklTpT6v7oJSjwpWZhxVqKD9QAkB5K8CIjHVDCbokt8hs3vP4sjoz aKfF+S+8EYsam1AfHMKN84SptmBsXXq3JHQeQS5ALd9aZLESVkDKEg04jM+7D1M= =B/gZ -----END PGP SIGNATURE----- --eUGqGfkt69yEwRle--