From owner-svn-src-all@FreeBSD.ORG Tue Aug 13 17:53:39 2013 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 53C94BE8; Tue, 13 Aug 2013 17:53:39 +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 0C48A292C; Tue, 13 Aug 2013 17:53:38 +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 7DC85DD66; Tue, 13 Aug 2013 17:53:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.8.3 mail0.glenbarber.us 7DC85DD66 Authentication-Results: mail0.glenbarber.us; dkim=none reason="no signature"; dkim-adsp=none Date: Tue, 13 Aug 2013 13:53:35 -0400 From: Glen Barber To: Ian Lepore Subject: Re: svn commit: r254217 - head/sys/conf Message-ID: <20130813175335.GR2432@glenbarber.us> References: <201308111357.r7BDvF7H065442@svn.freebsd.org> <1376407389.3320.209.camel@revolution.hippie.lan> <20130813153222.GL2432@glenbarber.us> <1376413337.3320.224.camel@revolution.hippie.lan> <20130813171302.GQ2432@glenbarber.us> <1376415112.3320.229.camel@revolution.hippie.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="QgvTbcZPsSS/HkXe" Content-Disposition: inline In-Reply-To: <1376415112.3320.229.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 17:53:39 -0000 --QgvTbcZPsSS/HkXe Content-Type: multipart/mixed; boundary="HKLejDDV6gCqJAZ/" Content-Disposition: inline --HKLejDDV6gCqJAZ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Aug 13, 2013 at 11:31:52AM -0600, Ian Lepore wrote: > I'm not even sure what $0 *should* expand to in a script that was > sourced in. The manpage doesn't say anything meaningful to me about it. > Maybe it's a kind of "indeterminate results" thing which is pretty much > what we're seeing. >=20 When the file is sourced, it should expand to the name of the file sourcing the file.=20 gjb@nucleus:~ % cat foo1.sh foo2.sh #!/bin/sh echo ${0} =2E foo2.sh #!/bin/sh echo ${0} gjb@nucleus:~ % sh ./foo1.sh =2E/foo1.sh =2E/foo1.sh > I was thinking that $(realpath ${PARAMFILE}) might be a good way to tap > dance around the problem, but PARAMFILE can be set by default from > $SYSDIR and it's not clear to me that that'll always be right either. >=20 Can you please try the attached patch? As with my prior tests, this works for me... Glen --HKLejDDV6gCqJAZ/ Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="newvers.sh.diff.txt" Content-Transfer-Encoding: quoted-printable Index: 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 --- head/sys/conf/newvers.sh (revision 254284) +++ head/sys/conf/newvers.sh (working copy) @@ -96,7 +96,7 @@ # 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 $(realpath ${0}) >/dev/null 2>&1 + ${dir}/svnversion ${SYSDIR}/Makefile >/dev/null 2>&1 if [ $? -eq 0 ]; then svnversion=3D${dir}/svnversion break @@ -105,7 +105,7 @@ done =20 if [ -z "${svnversion}" ] && [ -x /usr/bin/svnliteversion ] ; then - /usr/bin/svnliteversion $(realpath ${0}) >/dev/null 2>&1 + /usr/bin/svnliteversion ${SYSDIR}/Makefile >/dev/null 2>&1 if [ $? -eq 0 ]; then svnversion=3D/usr/bin/svnliteversion else --HKLejDDV6gCqJAZ/-- --QgvTbcZPsSS/HkXe Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.20 (FreeBSD) iQEcBAEBCAAGBQJSCnKfAAoJEFJPDDeguUajm/gIALmklKwCIQ0IYJEsAyYxp3x+ z1wnuYoOCX/dokqM/7eseDFFoxA0g5ovkD62juoJfb7NKoGtjt3ZFLA4E/3i8E6O xwHIgyO8JMjSyTFdklz7Zh3S9I79q8z+evfFvrHTil2vsnzbMmA1tu2ctSaP5E1T QUO4x7tQIBdh+1A4cBO7pz/6THE/nIAWnsGboPxZ54aDQAxRxtXZwP47GJNHXr5P RtfCfTALQLEkXd+KLFtwre4BQdrZ4pbldp0QMFaqXjqoCEEOes86Agh0zAfJJ/uZ VgZeM+gnuX9d3PeNr32ZuKtMVBr9YHcmeNNfprZG2QPdc1ZG6YRUb2m7UfXpzWM= =ppQR -----END PGP SIGNATURE----- --QgvTbcZPsSS/HkXe--