From ae2ccf9d6e8555600c78e3038d79fc3a6021e5ce Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 26 Nov 2025 22:44:14 +0900 Subject: [PATCH] TEST-35-LOGIN: fix bus path when the session does not have corresponding audit session If there is no corresponding audit session, then the session ID is prefixed with 'c', and in that case the session ID should be used as is in bus path. --- test/units/TEST-35-LOGIN.sh | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/test/units/TEST-35-LOGIN.sh b/test/units/TEST-35-LOGIN.sh index 4c5e9a51bb..c3dd11afa6 100755 --- a/test/units/TEST-35-LOGIN.sh +++ b/test/units/TEST-35-LOGIN.sh @@ -25,6 +25,17 @@ setup_test_user() { trap cleanup_test_user EXIT } +session_bus_path() { + local session + + session=$(loginctl list-sessions --no-legend | grep -v manager | awk '$3 == "logind-test-user" { print $1 }') + if ! [[ "${session?}" =~ c[0-9]* ]]; then + # When numeric, bus path is prefixed with '_3' + session="_3${session}" + fi + echo "/org/freedesktop/login1/session/${session}" +} + test_write_dropin() { systemctl edit --runtime --stdin systemd-logind.service --drop-in=debug.conf <