Nelson H. F. Beebe wrote: > Builds of grep-2.6 with native (non-gcc) compilers fail on several > systems because of source code errors: > > CC grep.o > "grep.c", line 10: void function cannot return value > "grep.c", line 16: void function cannot return value > "grep.c", line 22: void function cannot return value > cc: acomp failed for grep.c > > On at least one system, I got a failure of the foad1 test. > Examination of the saved output showed that the differences were from > colorization; once I did a > > unsetenv GREP_COLOR > > and reran the tests, they passed.
Hi Nelson, Thanks for the report. Here's the first step in fixing that: (next step is to convert foad1.sh to use the init.sh framework) >From 09a90757cd10899988c9ae1984debcfb9f99ec8c Mon Sep 17 00:00:00 2001 From: Jim Meyering <[email protected]> Date: Fri, 26 Mar 2010 11:17:17 +0100 Subject: [PATCH] tests: insulate tests from envvar settings * tests/init.cfg (vars_): Unset each envvar that can affect how grep works. This protects only those tests that have been converted to use init.sh. --- tests/init.cfg | 29 +++++++++++++++++++++++++++++ 1 files changed, 29 insertions(+), 0 deletions(-) diff --git a/tests/init.cfg b/tests/init.cfg index 6fec55e..0ec60f1 100644 --- a/tests/init.cfg +++ b/tests/init.cfg @@ -3,3 +3,32 @@ # Map settings of "none" to the empty string. test _"$LOCALE_FR" = _none && LOCALE_FR= test _"$LOCALE_FR_UTF8" = _none && LOCALE_FR_UTF8= + +# Unset key environment variables. +if (FOO=FOO; unset FOO) >/dev/null 2>&1; then + as_unset=unset +else + as_unset=false +fi + +# Derive this list by searching for string literals as the first +# argument to getenv: +# git grep getenv|perl -nle '/\bgetenv *\("(.+?)"\)/ and print $1'|sort -u grep +vars_=' +GREP_COLOR +GREP_COLORS +GREP_OPTIONS +TERM +' +envvar_check_fail=0 +for v_ in $vars_ +do + $as_unset $v_ + if eval test \"\${$v_+set}\" = set; then + echo "$0: the $v_ environment variable is set --" \ + ' unset it and rerun this test' >&2 + envvar_check_fail=1 + fi +done + +test "$envvar_check_fail" = 1 && fail_ "failed to unset the above envvars" -- 1.7.0.3.448.g82eeb
