tests: reinstate logname error verification

* 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.
This commit is contained in:
Bruno Haible
2026-04-17 15:46:19 +02:00
committed by Pádraig Brady
parent 15211db43f
commit 46f856156f
+4 -3
View File
@@ -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