Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Aug 2013 13:53:35 -0400
From:      Glen Barber <gjb@FreeBSD.org>
To:        Ian Lepore <ian@FreeBSD.org>
Cc:        svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org
Subject:   Re: svn commit: r254217 - head/sys/conf
Message-ID:  <20130813175335.GR2432@glenbarber.us>
In-Reply-To: <1376415112.3320.229.camel@revolution.hippie.lan>
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>

next in thread | previous in thread | raw e-mail | index | archive | help

--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--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130813175335.GR2432>