From c080f2e17b0744f92b18cd7df566f62d9be4196b Mon Sep 17 00:00:00 2001 From: WATANABE Yuki Date: Thu, 21 Nov 2024 01:39:24 +0900 Subject: [PATCH] tests/tilde-p: Honor logname utility only if succeeds On WSL, the logname utility fails, but the LOGNAME environment variable still holds a valid login name. We should overwrite the variable only when the logname utility returned a non-empty result. This change should avoid skipping test cases unnecessarily. --- tests/tilde-p.tst | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/tilde-p.tst b/tests/tilde-p.tst index 443147aa..fedf9436 100644 --- a/tests/tilde-p.tst +++ b/tests/tilde-p.tst @@ -101,7 +101,10 @@ __IN__ ( if - ! { LOGNAME="$(logname)" && export LOGNAME; } + logname=$(logname) + if [ "$logname" ]; then LOGNAME=$logname; fi + unset logname + ! { [ "$LOGNAME" ] && export LOGNAME; } then skip="true" elif