From a041593749921b9aca4f74b2fc4b679cddb26cee Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 8 Nov 2026 22:32:32 +0100 Subject: [PATCH] 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 --- tests/env/env.sh | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/env/env.sh b/tests/env/env.sh index ba723d11f..14d65e34f 100755 --- a/tests/env/env.sh +++ b/tests/env/env.sh @@ -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 < truetrue || framework_failure_ #!$SHELL