From 75ab8550e381c9064db6d819f9f1c78bb059bcfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustavo=20Andr=C3=A9=20dos=20Santos=20Lopes?= Date: Mon, 30 Mar 2026 22:14:34 +0100 Subject: [PATCH] fix(entity_id): Handle Podman cgroupns=host cgroup path with .scope/container suffix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit systemd + cgroup v2 (cgroupns=host) │ ...libpod-.scope/container When a container runs with systemd + crgroup v2 (cgroupns=host) the cgroup path has /container after .scope. 0::/machine.slice/libpod-HEXID.scope/container (podman never seems to set anything other than the default "container" -- could find no reference to `run.oci.systemd.subgroup` -- but match other strings as well. --- libdd-common/src/entity_id/unix/container_id.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libdd-common/src/entity_id/unix/container_id.rs b/libdd-common/src/entity_id/unix/container_id.rs index d45b0371d3..cf0fee1807 100644 --- a/libdd-common/src/entity_id/unix/container_id.rs +++ b/libdd-common/src/entity_id/unix/container_id.rs @@ -22,7 +22,7 @@ pub(crate) static LINE_REGEX: LazyLock = LazyLock::new(|| { pub(crate) static CONTAINER_REGEX: LazyLock = LazyLock::new(|| { #[allow(clippy::unwrap_used)] Regex::new(&format!( - r"({UUID_SOURCE}|{CONTAINER_SOURCE}|{TASK_SOURCE})(?:.scope)? *$" + r"({UUID_SOURCE}|{CONTAINER_SOURCE}|{TASK_SOURCE})(?:\.scope(?:/[^/ \t]+)?)? *$" )) .unwrap() }); @@ -77,6 +77,9 @@ mod tests { => Some("34dc0b5e626f2c5c4c5170e34b10e765-1234567890"), "1:name=systemd:/docker/34dc0b5e626f2c5c4c5170e34b10e7654ce36f0fcd532739f4445baabea03376.scope" => Some("34dc0b5e626f2c5c4c5170e34b10e7654ce36f0fcd532739f4445baabea03376"), + // Podman cgroup v2: libpod-HEXID.scope/container (cgroupns=host) + "0::/machine.slice/libpod-93afc7bc3ce42ad052d2926ffacfba941803bfae080941d1e1375d9d46b6a281.scope/container" + => Some("93afc7bc3ce42ad052d2926ffacfba941803bfae080941d1e1375d9d46b6a281"), // k8s with additional characters before ID "1:name=systemd:/kubepods.slice/kubepods-burstable.slice/kubepods-burstable-pod2d3da189_6407_48e3_9ab6_78188d75e609.slice/docker-7b8952daecf4c0e44bbcefe1b5c5ebc7b4839d4eefeccefe694709d3809b6199.scope" => Some("7b8952daecf4c0e44bbcefe1b5c5ebc7b4839d4eefeccefe694709d3809b6199"),