From 5002b576d8d3d338df90f7d51543f44dd571f388 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 20 May 2024 13:08:26 +0100 Subject: [PATCH 1/3] semaphore: use variable for Salsa repo URL Makes it easier to switch for debuggin --- .semaphore/semaphore-runner.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.semaphore/semaphore-runner.sh b/.semaphore/semaphore-runner.sh index 6b986b9bec5..755de22cf61 100755 --- a/.semaphore/semaphore-runner.sh +++ b/.semaphore/semaphore-runner.sh @@ -7,6 +7,7 @@ set -o pipefail # default to Debian testing DISTRO="${DISTRO:-debian}" RELEASE="${RELEASE:-bookworm}" +SALSA_URL="${SALSA_URL:-https://salsa.debian.org/systemd-team/systemd.git}" BRANCH="${BRANCH:-debian/master}" ARCH="${ARCH:-amd64}" CONTAINER="${RELEASE}-${ARCH}" @@ -72,7 +73,7 @@ for phase in "${PHASES[@]}"; do ;; RUN) # add current debian/ packaging - git fetch --depth=1 https://salsa.debian.org/systemd-team/systemd.git "$BRANCH" + git fetch --depth=1 "$SALSA_URL" "$BRANCH" git checkout FETCH_HEAD debian # craft changelog From c275e01d99acf502e32f442531902ea000dcd929 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 20 May 2024 13:08:56 +0100 Subject: [PATCH 2/3] logind: add one more debug log Helped track down issue with session tracking --- src/login/logind-dbus.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/login/logind-dbus.c b/src/login/logind-dbus.c index 53e966562e6..70fc9aeebf3 100644 --- a/src/login/logind-dbus.c +++ b/src/login/logind-dbus.c @@ -907,7 +907,10 @@ static int create_session( /* Check if we are already in a logind session, and if so refuse. */ r = manager_get_session_by_pidref(m, &leader, /* ret_session= */ NULL); if (r < 0) - return r; + return log_debug_errno( + r, + "Failed to check if process " PID_FMT " is already in a session: %m", + leader.pid); if (r > 0) return sd_bus_error_setf(error, BUS_ERROR_SESSION_BUSY, "Already running in a session or user slice"); From eb56b564a04b2c34a80bea9ede541c573fb41501 Mon Sep 17 00:00:00 2001 From: Luca Boccassi Date: Mon, 20 May 2024 13:12:03 +0100 Subject: [PATCH 3/3] logind: do not fail creating a session when request is not from a unit When running inside an LXC container the 'su' process will not be part of any unit or slice. manager_get_user_by_pid() which was used until v255 (included) does not fail if it cannot find a unit/slice, but simply returns 'not found'. Do the same in manager_get_session_by_pidref(). This was not detected as Semaphore CI does not reboot the testbed before the logind test, so the session is started by the old logind from the base distro, instead of the one being tested. Follow-up for 8494f562c8963d8a936b0598e23eab277ff29374 Follow-up for 5099a50d4398e190387d204f5df81cc176bd33e2 Fixes https://github.com/systemd/systemd/issues/32929 --- src/login/logind-core.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/login/logind-core.c b/src/login/logind-core.c index d20ff3d4d48..71e4247a799 100644 --- a/src/login/logind-core.c +++ b/src/login/logind-core.c @@ -371,10 +371,8 @@ int manager_get_session_by_pidref(Manager *m, const PidRef *pid, Session **ret) return r; } else { r = cg_pidref_get_unit(pid, &unit); - if (r < 0) - return r; - - s = hashmap_get(m->session_units, unit); + if (r >= 0) + s = hashmap_get(m->session_units, unit); } if (ret)