mirror of
https://git.savannah.gnu.org/git/coreutils.git
synced 2026-11-17 18:02:09 +03:00
tests: env: check a leading '=' in attached short option values
* tests/env/env.sh: Ensure -C=DIR, -vC=DIR, -S'-C=DIR ...' and -C= change to a directory whose name starts with '=', that -a=NAME sets argv[0] to '=NAME', and that -u=NAME and -vu=NAME are rejected. https://github.com/uutils/coreutils/pull/15838 Link: https://github.com/coreutils/coreutils/pull/454
This commit is contained in:
1 parent
981125e918
commit
a041593749
1 file changed
+16
Vendored
+16
@@ -174,6 +174,22 @@ exp=$(cd empty && env pwd) || framework_failure_
|
||||
got=$(env --chdir=empty pwd) || fail=1
|
||||
test "$exp" = "$got" || fail=1
|
||||
|
||||
# A leading '=' in a value attached to a short option is part of the value.
|
||||
mkdir -p =/d || framework_failure_
|
||||
exp=$(cd =/d && env pwd) || framework_failure_
|
||||
got=$(env -C=/d pwd) || fail=1
|
||||
test "$exp" = "$got" || fail=1
|
||||
got=$(env -vC=/d pwd 2>/dev/null) || fail=1
|
||||
test "$exp" = "$got" || fail=1
|
||||
got=$(env -S'-C=/d pwd') || fail=1
|
||||
test "$exp" = "$got" || fail=1
|
||||
exp=$(cd = && env pwd) || framework_failure_
|
||||
got=$(env -C= pwd) || fail=1
|
||||
test "$exp" = "$got" || fail=1
|
||||
test "$(env -a=name sh -c 'echo "$0"')" = '=name' || fail=1
|
||||
returns_ 125 env -u=FOO true || fail=1
|
||||
returns_ 125 env -vu=FOO true 2>/dev/null || fail=1
|
||||
|
||||
# Verify argv0 overriding
|
||||
cat <<EOF > truetrue || framework_failure_
|
||||
#!$SHELL
|
||||
|
||||
Reference in new issue
Block a user