From 243f1b1c71136171a4da635a84f8e32ba3eb3c94 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 26 Oct 2009 07:10:51 -0600 Subject: env: reject bogus -u arguments * src/env.c (main): Use unsetenv rather than putenv to remove items from environ, and check for failure. * bootstrap.conf (gnulib_modules): Add unsetenv. * tests/misc/env: Test this. * NEWS: Document it. --- tests/misc/env | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'tests') diff --git a/tests/misc/env b/tests/misc/env index 1e0a22eae..07dd9e468 100755 --- a/tests/misc/env +++ b/tests/misc/env @@ -48,7 +48,7 @@ env sh -c 'exit 2' # exit status propagation test $? = 2 || fail=2 env . # invalid command test $? = 126 || fail=1 -env ... # no such command +env no_such # no such command test $? = 127 || fail=1 # Cygwin requires a minimal environment to launch new processes, so a @@ -105,8 +105,10 @@ esac # test "x`env c=d echo fail`" = xfail || fail=1 # test "x`env -- c=d echo fail`" = xpass || fail=1 -# FIXME - decide whether we like this behavior -# test `env -i -u a=b` = a=b || fail=1 -# env -u '' true || fail=1 +# catch unsetenv failure, broken through coreutils 8.0 +env -u a=b true && fail=1 +test $? = 125 || fail=1 +env -u '' true && fail=1 +test $? = 125 || fail=1 Exit $fail -- cgit v1.2.3-54-g00ecf