From 5f9435cfe974cdbbd794a9b8436b5356365067dc Mon Sep 17 00:00:00 2001 From: Robin Candau Date: Fri, 8 May 2026 09:59:51 +0200 Subject: [PATCH] Drop placeholder substitution for ldconfig aux-cache cleanup in Dockerfile template In https://gitlab.archlinux.org/archlinux/archlinux-docker/-/commit/4b15f9a1a11d11474cad201521962dc6192630ea, a placeholder for the ldconfig aux-cache cleanup (required for the repro image) was implemented in the Dockerfile template and was substituted by either `&& rm -f /var/cache/ldconfig/aux-cache` for the repro group or `&& true` for other groups (so that it does nothing). While technically harmless, the resulting `&& true` for the non-repro groups is slightly confusing and may raise some eyebrows (see https://github.com/docker-library/official-images/pull/21366). This change aims to drop the placeholder for the ldconfig aux-cache cleanup in the Dockerfile template and simply expand the "ldconfig + sed" RUN command to include the ldconfig aux-cache cleanup for the repro group. This results in a more precisely targeted substitution without unnecessary and confusing addition in the Dockerfile of the non-repro groups. --- Dockerfile.template | 3 +-- scripts/make-dockerfile.sh | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Dockerfile.template b/Dockerfile.template index 4bb2c65..6ecfc3d 100644 --- a/Dockerfile.template +++ b/Dockerfile.template @@ -37,8 +37,7 @@ LABEL org.opencontainers.image.created="TEMPLATE_CREATED" COPY --from=verify /rootfs/ / RUN ldconfig && \ - sed -i '/BUILD_ID/a VERSION_ID=TEMPLATE_VERSION_ID' /etc/os-release && \ - LDCONFIG_AUX_CACHE + sed -i '/BUILD_ID/a VERSION_ID=TEMPLATE_VERSION_ID' /etc/os-release ENV LANG=C.UTF-8 CMD ["/usr/bin/bash"] diff --git a/scripts/make-dockerfile.sh b/scripts/make-dockerfile.sh index 2691268..ddc355f 100755 --- a/scripts/make-dockerfile.sh +++ b/scripts/make-dockerfile.sh @@ -22,10 +22,8 @@ CI_COMMIT_SHA="${CI_COMMIT_SHA:-$(git rev-parse HEAD)}" # Honor SOURCE_DATE_EPOCH and delete non-determistic ldconfig auxiliary cache file for the repro GROUP if [[ "$GROUP" == "repro" ]]; then CREATED_TIMESTAMP=$(date -u -d "@$SOURCE_DATE_EPOCH" +%Y-%m-%dT%H:%M:%SZ) - LDCONFIG_AUX_CACHE="rm -f /var/cache/ldconfig/aux-cache" else CREATED_TIMESTAMP=$(date -Is) - LDCONFIG_AUX_CACHE="true" fi sed -e "s|TEMPLATE_ROOTFS_FILE|$ROOTFS_FILE|" \ @@ -35,5 +33,9 @@ sed -e "s|TEMPLATE_ROOTFS_FILE|$ROOTFS_FILE|" \ -e "s|TEMPLATE_VERSION_ID|$BUILD_VERSION|" \ -e "s|TEMPLATE_REVISION|$CI_COMMIT_SHA|" \ -e "s|TEMPLATE_CREATED|$CREATED_TIMESTAMP|" \ - -e "s|LDCONFIG_AUX_CACHE|$LDCONFIG_AUX_CACHE|" \ Dockerfile.template > "$OUTPUTDIR/Dockerfile.$GROUP" + +if [[ "$GROUP" == "repro" ]]; then + sed -i '/VERSION_ID=.*os-release$/ s/$/ \&\& \\\n rm -f \/var\/cache\/ldconfig\/aux-cache/' \ + "$OUTPUTDIR/Dockerfile.$GROUP" +fi