tests/run-all uses `sh' to execute tests/run-*. If sh is bash 5.3+,
running tests/run-test will fail because `unset UID' causes a posix-
mode non-interactive bash to exit.

No other run-* scripts attempt to unset UID, though a number of tests
(including the ones that run-test executes) do check the value of $UID,
so unsetting UID did serve a purpose if UID was set incorrectly (and sh
is not a recent bash).

If avoiding potentially wrong results in such cases is important, we
could replace usage of $UID with $(id -u) within the tests, but I'm not
sure it is worth worrying about.

As a side note, it is kind of surprising that if {E,}UID is present in
the environment, the value is inherited (and the resulting variable is
not readonly).

This does not seem in line with the documentation, which states:

    UID    Expands to the user ID of the current user, initialized at
           shell startup.  This variable is readonly.
---
 tests/run-test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/run-test b/tests/run-test
index d68791ca..03c9bd29 100644
--- a/tests/run-test
+++ b/tests/run-test
@@ -1,4 +1,4 @@
-unset GROUPS UID 2>/dev/null
+unset GROUPS 2>/dev/null
 
 ${THIS_SH} ./test.tests >${BASH_TSTOUT} 2>&1
 diff ${BASH_TSTOUT} test.right && rm -f ${BASH_TSTOUT}
-- 
2.54.0


Reply via email to