]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: reinstate logname error verification
authorBruno Haible <bruno@clisp.org>
Fri, 17 Apr 2026 13:46:19 +0000 (15:46 +0200)
committerPádraig Brady <P@draigBrady.com>
Fri, 17 Apr 2026 15:15:08 +0000 (16:15 +0100)
* tests/misc/user.sh: Modify the "unshare -U logname" test, so that it
does not fail on glibc versions (< 2.28, >= 2.38) that do a fallback
lookup based on the tty.

tests/misc/user.sh

index 8385d1058afef7f98384e395687593841c6fa874..931287e4192db7179e1eb1ada5e3f0de37b3731c 100755 (executable)
@@ -25,8 +25,9 @@ overflow_uid=$(cat /proc/sys/kernel/overflowuid) ||
 
 test "$(unshare -U whoami)" = "$(id -un $overflow_uid)" || fail=1
 
-# FIXME: Fails with Manjaro Linux
-#returns_ 1 unshare -U logname 2>err || fail=1
-#test "$(cat err)" = "logname: no login name" || fail=1
+# The "</dev/null" disables a fallback lookup via utmp/utmpx,
+# that existed in glibc < 2.28 and exists again in glibc >= 2.38.
+returns_ 1 unshare -U logname </dev/null 2>err || fail=1
+test "$(cat err)" = "logname: no login name" || fail=1
 
 Exit $fail