[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
don't augment PATH in TESTS_ENVIRONMENT
From: |
Bruno Haible |
Subject: |
don't augment PATH in TESTS_ENVIRONMENT |
Date: |
Sat, 4 Sep 2010 12:15:26 +0200 |
User-agent: |
KMail/1.9.9 |
Hi Jim,
It is not possible to portably augment the same environment variable twice
in TESTS_ENVIRONMENT.
Witness: The shell command
foo=a:$foo foo=b:$foo sh -c 'echo $foo'
prints
b:a: in ksh, OpenBSD /bin/sh
a:b: in Solaris 8 /bin/sh
b: in NetBSD /bin/sh and dash
and in bash 3.2.39 it's even weirder:
b:a: the first time,
b: the second time
$ foo=a:$foo foo=b:$foo sh -c 'echo $foo'
b:a:
$ foo=a:$foo foo=b:$foo sh -c 'echo $foo'
b:
As a consequence, since there are many modules, no gnulib module should
augment PATH in TESTS_ENVIRONMENT. If two of them do that, you get a collision.
Or if one of them does this, and the program's Makefile.am does it as well
(like recommended in tests/init.sh), you get a collision.
Conclusion: Only the program's Makefile.am is allowed to do this.
Here are proposed patches to fix this in these two commits:
2009-08-03 Joel E. Denny <address@hidden>
update-copyright: fix bug for 2-digit last year and add tests
* build-aux/update-copyright: Fix bug.
Use UPDATE_COPYRIGHT_YEAR from environment as current year if
specified.
* modules/update-copyright-tests: New
* tests/test-update-copyright.sh: New.
<http://lists.gnu.org/archive/html/bug-gnulib/2008-05/msg00010.html>
2008-05-01 Jim Meyering <address@hidden>
vc-list-files: make the stand-alone gnulib test work
* modules/vc-list-files-tests (configure.ac):
Define and AC_SUBST abs_aux_dir.
(Makefile.am) [TESTS_ENVIRONMENT]: Rather than passing
$(abs_top_srcdir) to each script and having each of them
duplicate the work of setting PATH, set PATH here, using
the new variable, abs_aux_dir instead.
* tests/test-vc-list-files-cvs.sh: Don't set PATH here.
* tests/test-vc-list-files-git.sh: Likewise.
Reported by Bruno Haible.
2010-09-04 Bruno Haible <address@hidden>
Don't augment PATH in TESTS_ENVIRONMENT.
* modules/update-copyright-tests (Makefile.am): In TESTS_ENVIRONMENT,
set abs_aux_dir instead of augmenting PATH.
* modules/vc-list-files-tests (Makefile.am): Likewise.
* tests/test-update-copyright.sh: Augment PATH here.
* tests/test-vc-list-files-cvs.sh: Augment PATH here, through
path_prepend_.
* tests/test-vc-list-files-git.sh: Likewise.
--- modules/update-copyright-tests.orig Sat Sep 4 12:12:10 2010
+++ modules/update-copyright-tests Sat Sep 4 12:06:32 2010
@@ -9,4 +9,4 @@
Makefile.am:
TESTS += test-update-copyright.sh
-TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)'$(PATH_SEPARATOR)"$$PATH"
+TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
--- modules/vc-list-files-tests.orig Sat Sep 4 12:12:10 2010
+++ modules/vc-list-files-tests Sat Sep 4 12:06:34 2010
@@ -12,4 +12,4 @@
Makefile.am:
TESTS += test-vc-list-files-git.sh
TESTS += test-vc-list-files-cvs.sh
-TESTS_ENVIRONMENT += PATH='$(abs_aux_dir)'$(PATH_SEPARATOR)"$$PATH"
+TESTS_ENVIRONMENT += abs_aux_dir='$(abs_aux_dir)'
--- tests/test-update-copyright.sh.orig Sat Sep 4 12:12:10 2010
+++ tests/test-update-copyright.sh Sat Sep 4 12:11:49 2010
@@ -27,6 +27,9 @@
compare() { cmp "$@"; }
fi
+# Ensure the update-copyright program gets found.
+PATH=$abs_aux_dir:$PATH
+
TMP_BASE=update-copyright.test
trap 'rm -f $TMP_BASE*' 0 1 2 3 15
--- tests/test-vc-list-files-cvs.sh.orig Sat Sep 4 12:12:10 2010
+++ tests/test-vc-list-files-cvs.sh Sat Sep 4 12:11:51 2010
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ .
+. "$srcdir/init.sh"; path_prepend_ $abs_aux_dir .
tmpdir=vc-cvs
repo=`pwd`/$tmpdir/repo
--- tests/test-vc-list-files-git.sh.orig Sat Sep 4 12:12:10 2010
+++ tests/test-vc-list-files-git.sh Sat Sep 4 12:11:51 2010
@@ -17,7 +17,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. */
: ${srcdir=.}
-. "$srcdir/init.sh"; path_prepend_ .
+. "$srcdir/init.sh"; path_prepend_ $abs_aux_dir .
tmpdir=vc-git-$$
GIT_DIR= GIT_WORK_TREE=; unset GIT_DIR GIT_WORK_TREE
- don't augment PATH in TESTS_ENVIRONMENT,
Bruno Haible <=
- Re: don't augment PATH in TESTS_ENVIRONMENT, Jim Meyering, 2010/09/04
- Re: don't augment PATH in TESTS_ENVIRONMENT, Bruno Haible, 2010/09/04
- Re: don't augment PATH in TESTS_ENVIRONMENT, Jim Meyering, 2010/09/04
- Re: absolute build directory with spaces, Bruno Haible, 2010/09/04
- Re: absolute build directory with spaces, Stefano Lattarini, 2010/09/04
- Re: absolute build directory with spaces, Jim Meyering, 2010/09/04
- Re: absolute build directory with spaces, Stefano Lattarini, 2010/09/04
- Re: absolute build directory with spaces, Ralf Wildenhues, 2010/09/05
- [RFC] Make build and install dirs used by distcheck configurable. (was: Re: absolute build directory with spaces), Stefano Lattarini, 2010/09/06
- Re: absolute build directory with spaces, Jim Meyering, 2010/09/04