[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: groups --version

From: Jim Meyering
Subject: Re: groups --version
Date: Fri, 31 Aug 2007 21:57:35 +0200

Eric Blake <address@hidden> wrote:
> Sorry for the false alarm, then.  But, on the other hand, there is a potential
> issue if the user has CDPATH set in the environment with . on the list, for
> those tests that do not source envvar-check, since $tmp is always relative.
> POSIX requires 'CDPATH=. cd $tmp' to print to stdout, whereas
> 'CDPATH=. cd ./$tmp' must be silent.  Also, if the user happens to have 
> another
> directory accessible from CDPATH that matches $tmp (although this is less
> likely, due to the use of $$ in $tmp), then only the 'cd ./$tmp' form
> guarantees that CDPATH is not consulted.  So should we do this?
> diff --git a/tests/sample-test b/tests/sample-test
> index 4d962d0..1533c3f 100644
> --- a/tests/sample-test
> +++ b/tests/sample-test
> @@ -33,7 +33,7 @@ trap '(exit $?); exit $?' 1 2 13 15
>  framework_failure=0
>  mkdir -p $tmp || framework_failure=1
> -cd $tmp || framework_failure=1
> +cd ./$tmp || framework_failure=1

Good point.
But wouldn't it be better to disable this feature (unset CDPATH?)
globally than to try to fix all uses of "cd"?

FWIW, I plan to factor out a lot of the set-up bits that
are in sample-test and put them in shell functions that
will then be used from all of the sample-test-derived scripts.
Of course, with that change, if you're running "make check" with
a /bin/sh that doesn't understand functions, many tests will be skipped.
But that's better than polluting hundreds of scripts to accommodate
running tests on a few ancient systems.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]