From 0f844783a3ccc899f3dacf7ee7413a975a79a455 Mon Sep 17 00:00:00 2001 From: librelad Date: Thu, 25 Jun 2026 12:41:57 +0100 Subject: [PATCH] fix(docker/rootless): parse slirp4netns version cleanly slirp4netns --version prints multiple lines (version, commit, libslirp, SLIRP_CONFIG_VERSION_MAX). The old 'awk {print $2}' ran on every line and also picked the literal word 'version' from line 1, producing a multi-line blob that leaked into the 'is outdated' notice. Read only the first line and take field 3 (the actual number), strip the leading v from the GitHub tag so the comparison is meaningful, and skip the check if the tag fetch fails. Co-Authored-By: Claude Opus 4.8 Signed-off-by: librelad --- scripts/docker/install/rootless/rootless_docker.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/docker/install/rootless/rootless_docker.sh b/scripts/docker/install/rootless/rootless_docker.sh index 96416d8..bc244bc 100755 --- a/scripts/docker/install/rootless/rootless_docker.sh +++ b/scripts/docker/install/rootless/rootless_docker.sh @@ -35,9 +35,12 @@ installDockerRootless() checkSuccess "Installing slirp4netns" else isNotice "slirp4netns is already installed" - installed_version=$(slirp4netns --version | awk '{print $2}') + # `slirp4netns --version` prints several lines (version, commit, libslirp, + # SLIRP_CONFIG_VERSION_MAX); read only the first line and take the version field. + installed_version=$(slirp4netns --version | head -n1 | awk '{print $3}') latest_version=$(curl -s https://api.github.com/repos/rootless-containers/slirp4netns/releases/latest | grep tag_name | cut -d '"' -f 4) - if [[ "$installed_version" != "$latest_version" ]]; then + latest_version=${latest_version#v} # GitHub tags are vX.Y.Z; strip the v to compare + if [[ -n "$latest_version" && "$installed_version" != "$latest_version" ]]; then isNotice "slirp4netns version $installed_version is outdated." isNotice "Installing version $latest_version..." local result; result=$(runSystem apt-get update)