Compare commits

..
Author SHA1 Message Date
shadowdaoandClaude Sonnet 5.5 5dbc496313 fix(lsphp): ext-build survives LiteSpeed's empty lsphpNN-dev maintainer scripts under BuildKit's QEMU
arm64-attach run 5815 (cac-lsphp:php85) failed in the ext-build apt step: dpkg could not run the
0-byte postinst of lsphp85-dev ("Error while loading ...postinst: Exec format error", the QEMU
emulator wrapper does not give dpkg the ENOEXEC/sh fallback). Retry once after giving empty
maintainer scripts a shebang. Throwaway builder stage only; never taken on amd64.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-20 07:39:38 -08:00
jknapp 69e120df0f Merge pull request #56: arm64-attach OLS family [skip ci]
[skip ci]
2026-11-20 14:32:36 +00:00
+16
View File
@@ -108,11 +108,27 @@ ARG PKG_CACHE=
COPY ./scripts/pkg-cache-repos.sh /usr/local/sbin/pkg-cache-repos.sh
COPY ./keys/pkg-cache/ /usr/local/share/pkg-cache/
COPY ./scripts/lsphp-apt-upgrade.sh /usr/local/sbin/lsphp-apt-upgrade.sh
## arm64 under BuildKit's QEMU emulator: LiteSpeed ships 0-byte postinst/prerm scripts in
## lsphpNN-dev. A native kernel (and QEMU via binfmt) answers ENOEXEC and dpkg's execvp falls back
## to /bin/sh, but the emulator wrapper execs the file itself and dies with "Error while loading
## ...postinst: Exec format error", so dpkg --configure fails. Only if the first install fails,
## give every empty maintainer script a shebang (no behaviour change: they were empty) and finish
## the configure, then re-run the same install so every check in it still runs. amd64 and QEMU
## setups that handle this never take the branch.
RUN set -e; \
/usr/local/sbin/pkg-cache-repos.sh apt; \
install_dev() { \
/usr/local/sbin/lsphp-apt-upgrade.sh --no-os-upgrade "${PHPVER}" \
build-essential autoconf pkg-config \
lsphp${PHPVER}-dev; \
}; \
if ! install_dev; then \
echo "install of lsphp${PHPVER}-dev failed: repairing empty maintainer scripts, then retrying once" >&2; \
find /var/lib/dpkg/info -type f \( -name '*.preinst' -o -name '*.postinst' -o -name '*.prerm' -o -name '*.postrm' \) -size 0 \
-exec sh -c 'printf "#!/bin/sh\nexit 0\n" > "$1"' _ {} \; ; \
dpkg --configure -a; \
install_dev; \
fi; \
/usr/local/sbin/pkg-cache-repos.sh restore; \
RTV=$(dpkg-query -W -f='${Version}' lsphp${PHPVER}); \
DEVV=$(dpkg-query -W -f='${Version}' lsphp${PHPVER}-dev); \