[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: don't augment PATH in TESTS_ENVIRONMENT
From: |
Jim Meyering |
Subject: |
Re: don't augment PATH in TESTS_ENVIRONMENT |
Date: |
Sat, 04 Sep 2010 12:49:52 +0200 |
Bruno Haible wrote:
> 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.
Hi Bruno,
Good catch. Thanks for doing that.
Your patch looks right and reminds me that many
tests remain to be converted to use init.sh.
This is something that we can easily detect mechanically, in order
to prevent recurrence. Here's what I will apply right after yours.
The regexp isn't as tight as it could be, but it's
adequate for now; if a gnulib module someday sets PATH
to a value not including $$PATH, we'll adapt.
>From 50eb8332f31f34be4fa5d9992dcdd198efbb905d Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Sat, 4 Sep 2010 12:45:22 +0200
Subject: [PATCH] tests: add a second syntax-check rule
* Makefile (sc_do_not_augment_PATH_via_TESTS_ENVIRONMENT): New rule.
---
ChangeLog | 5 +++++
Makefile | 12 +++++++++++-
2 files changed, 16 insertions(+), 1 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 5be2ceb..60454b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-04 Jim Meyering <address@hidden>
+
+ tests: add a second syntax-check rule
+ * Makefile (sc_do_not_augment_PATH_via_TESTS_ENVIRONMENT): New rule.
+
2010-09-02 Paul Eggert <address@hidden>
hash: fix safe_hasher const typo
diff --git a/Makefile b/Makefile
index 0596ba6..227a89c 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,9 @@ info html dvi pdf:
cd doc && $(MAKE) $@ && $(MAKE) mostlyclean
# Perform some platform independent checks on the gnulib code.
-check: sc_prefer_ac_check_funcs_once
+check: \
+ sc_do_not_augment_PATH_via_TESTS_ENVIRONMENT \
+ sc_prefer_ac_check_funcs_once
sc_prefer_ac_check_funcs_once:
if test -d .git; then \
@@ -22,6 +24,14 @@ sc_prefer_ac_check_funcs_once:
in modules/ 1>&2; exit 1; } || : \
else :; fi
+sc_do_not_augment_PATH_via_TESTS_ENVIRONMENT:
+ if test -d .git; then \
+ url=http://article.gmane.org/gmane.comp.lib.gnulib.bugs/22874;\
+ git grep '^[ ]*TESTS_ENVIRONMENT += PATH=' modules \
+ && { printf '%s\n' 'Do not augment PATH via TESTS_ENVIRONMENT;' \
+ " see <$$url>" 1>&2; exit 1; } || : \
+ else :; fi
+
# Regenerate some files that are stored in the repository.
regen: MODULES.html
--
1.7.2.2.566.g36af9
- don't augment PATH in TESTS_ENVIRONMENT, Bruno Haible, 2010/09/04
- Re: don't augment PATH in TESTS_ENVIRONMENT,
Jim Meyering <=
- 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