mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
Avoid unsetenv() on a non standard environment,
as FreeBSD 14 and 15 at least fail when manipulating
such an environment with unsetenv().
$ printf 'A=1\0A=2\0foo\0' |
src/env --env0-from=- src/env foo=bar | grep foo
foo=bar
foo
$ printf 'A=1\0A=2\0foo\0' |
src/env --env0-from=- src/env -u foo
env: environment corrupt; missing value for foo
env: cannot unset ‘foo’: Bad address
$ printf 'A=1\0A=2\0foo\0' |
src/env --env0-from=- src/env -u bar
env: environment corrupt; missing value for foo
env: cannot unset ‘bar’: Bad address
* tests/env/env0-from.sh: Use routines internal to env(1)
to manipulate the environment, only delegating the
executed env(1) to adding any implicit environment variables.
Reported by Bruno Haible.