Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d7141a5e1a | ||
|
|
2c7a04b4d0 | ||
|
|
5dbc496313 | ||
|
|
69e120df0f |
No files matched your search
@@ -266,7 +266,7 @@ jobs:
|
|||||||
# OLS family: the arm64 (packaged lsphp / OLS from the LiteSpeed repo and base image) must be
|
# OLS family: the arm64 (packaged lsphp / OLS from the LiteSpeed repo and base image) must be
|
||||||
# observably the SAME PHP as the existing amd64 image (php.net-source or packaged): identical
|
# observably the SAME PHP as the existing amd64 image (php.net-source or packaged): identical
|
||||||
# PHP_VERSION, SAPI, loaded extensions + versions and EVERY ini value, both with the image's
|
# PHP_VERSION, SAPI, loaded extensions + versions and EVERY ini value, both with the image's
|
||||||
# config and with `-n` (compiled-in defaults). scripts/arm64-parity-probe.php runs natively on
|
# config and with no ini at all (compiled-in defaults, one known exception). scripts/arm64-parity-probe.php runs natively on
|
||||||
# amd64 and under QEMU (a throwaway BuildKit RUN) on arm64; any difference prints as a diff
|
# amd64 and under QEMU (a throwaway BuildKit RUN) on arm64; any difference prints as a diff
|
||||||
# and fails the run before the tag is touched. shared-ols runs no PHP: openlitespeed -v only.
|
# and fails the run before the tag is touched. shared-ols runs no PHP: openlitespeed -v only.
|
||||||
- name: "Parity - same PHP / OLS as the existing amd64 image"
|
- name: "Parity - same PHP / OLS as the existing amd64 image"
|
||||||
@@ -292,22 +292,35 @@ jobs:
|
|||||||
diff -u "$work/amd/ols.txt" "$work/out/ols.txt" || { echo "::error::openlitespeed version/modules differ between amd64 and arm64; not attaching"; exit 1; }
|
diff -u "$work/amd/ols.txt" "$work/out/ols.txt" || { echo "::error::openlitespeed version/modules differ between amd64 and arm64; not attaching"; exit 1; }
|
||||||
[ "$IMAGE" != shared-ols ] || { echo "parity OK: OpenLiteSpeed version and modules identical (shared-ols runs no PHP)"; exit 0; }
|
[ "$IMAGE" != shared-ols ] || { echo "parity OK: OpenLiteSpeed version and modules identical (shared-ols runs no PHP)"; exit 0; }
|
||||||
ls_bin="/usr/local/lsws/lsphp${PHPVER}/bin/lsphp"
|
ls_bin="/usr/local/lsws/lsphp${PHPVER}/bin/lsphp"
|
||||||
for mode in cfg n; do
|
# cfg = the image's own config (what customers get); def = compiled-in defaults only
|
||||||
flag=""; [ "$mode" = n ] && flag="-n"
|
# (no php.ini, no scan dir). (`lsphp -n` is not usable: it only prints usage.)
|
||||||
|
for mode in cfg def; do
|
||||||
|
env_=""; flag=""; [ "$mode" = def ] && { env_="PHP_INI_SCAN_DIR=/nonexistent"; flag="-c /nonexistent"; }
|
||||||
# probe piped over stdin (not a bind mount: the job's docker daemon cannot see the workspace)
|
# probe piped over stdin (not a bind mount: the job's docker daemon cannot see the workspace)
|
||||||
docker run --rm -i --platform linux/amd64 --entrypoint sh "$REPO@$AMD64" -c "cat > /tmp/probe.php; $ls_bin $flag /tmp/probe.php" < "$work/ctx/probe.php" > "$work/amd/$mode.txt"
|
docker run --rm -i --platform linux/amd64 --entrypoint sh "$REPO@$AMD64" -c "cat > /tmp/probe.php; $env_ $ls_bin $flag /tmp/probe.php" < "$work/ctx/probe.php" > "$work/amd/$mode.txt"
|
||||||
done
|
done
|
||||||
# the same two runs on arm64, inside one BuildKit build (no binfmt for `docker run` here)
|
# the same two runs on arm64, inside one BuildKit build (no binfmt for `docker run` here)
|
||||||
printf 'FROM %s@%s AS src\nCOPY probe.php /probe.php\nRUN %s /probe.php > /cfg.txt && %s -n /probe.php > /n.txt\nFROM scratch\nCOPY --from=src /cfg.txt /n.txt /\n' "$REPO" "$ARM64_DIGEST" "$ls_bin" "$ls_bin" |
|
printf 'FROM %s@%s AS src\nCOPY probe.php /probe.php\nRUN %s /probe.php > /cfg.txt && PHP_INI_SCAN_DIR=/nonexistent %s -c /nonexistent /probe.php > /def.txt\nFROM scratch\nCOPY --from=src /cfg.txt /def.txt /\n' "$REPO" "$ARM64_DIGEST" "$ls_bin" "$ls_bin" |
|
||||||
docker buildx build --platform linux/arm64 --output "type=local,dest=$work/out" -f - "$work/ctx"
|
docker buildx build --platform linux/arm64 --output "type=local,dest=$work/out" -f - "$work/ctx"
|
||||||
rc=0
|
rc=0
|
||||||
for mode in cfg n; do
|
for mode in cfg def; do
|
||||||
echo "== $mode: $(head -1 "$work/amd/$mode.txt") (amd64) vs $(head -1 "$work/out/$mode.txt") (arm64); $(grep -c '^ext ' "$work/amd/$mode.txt") / $(grep -c '^ext ' "$work/out/$mode.txt") extensions, $(grep -c '^ini ' "$work/amd/$mode.txt") / $(grep -c '^ini ' "$work/out/$mode.txt") ini values"
|
echo "== $mode: $(head -1 "$work/amd/$mode.txt") (amd64) vs $(head -1 "$work/out/$mode.txt") (arm64); $(grep -c '^ext ' "$work/amd/$mode.txt") / $(grep -c '^ext ' "$work/out/$mode.txt") extensions, $(grep -c '^ini ' "$work/amd/$mode.txt") / $(grep -c '^ini ' "$work/out/$mode.txt") ini values"
|
||||||
grep -q '^PHP_VERSION=[0-9]' "$work/amd/$mode.txt" || { echo "::error::cannot read the amd64 probe output ($mode)"; exit 1; }
|
grep -q '^PHP_VERSION=[0-9]' "$work/amd/$mode.txt" || { echo "::error::cannot read the amd64 probe output ($mode)"; exit 1; }
|
||||||
diff -u "$work/amd/$mode.txt" "$work/out/$mode.txt" || rc=1
|
if [ "$mode" = cfg ]; then
|
||||||
|
diff -u "$work/amd/$mode.txt" "$work/out/$mode.txt" || rc=1
|
||||||
|
else
|
||||||
|
# KNOWN, accepted difference (docs/arm64-ols-family.md): LiteSpeed's packaged arm64 lsphp is compiled with
|
||||||
|
# session.upload_progress.enabled=0, its amd64 package (and our php.net-source amd64 image, which copies
|
||||||
|
# it) with 1. Both images ship session.upload_progress.enabled=0 in their ini (zz-php2shell-mitigation.ini),
|
||||||
|
# so the EFFECTIVE value (cfg mode, compared above with no exception) is identical. Any OTHER compiled-in
|
||||||
|
# difference fails the run.
|
||||||
|
known='^ini session\.upload_progress\.enabled='
|
||||||
|
echo "known compiled-in difference (not a failure): amd64 $(grep "$known" "$work/amd/def.txt") / arm64 $(grep "$known" "$work/out/def.txt")"
|
||||||
|
diff -u <(grep -v "$known" "$work/amd/def.txt") <(grep -v "$known" "$work/out/def.txt") || rc=1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
[ "$rc" = 0 ] || { echo "::error::the new arm64 is not the same PHP as the existing amd64 image (diff above); not attaching. Rebuild amd64 or fix the arm64 build first."; exit 1; }
|
[ "$rc" = 0 ] || { echo "::error::the new arm64 is not the same PHP as the existing amd64 image (diff above); not attaching. Rebuild amd64 or fix the arm64 build first."; exit 1; }
|
||||||
echo "parity OK: version, SAPI, extensions and every ini value identical"
|
echo "parity OK: version, SAPI, extensions and every effective ini value identical; compiled-in defaults identical apart from the known session.upload_progress.enabled"
|
||||||
|
|
||||||
# Re-creates the tag index: existing amd64 entries by digest + the new arm64. Aborts if the
|
# Re-creates the tag index: existing amd64 entries by digest + the new arm64. Aborts if the
|
||||||
# tag moved since the plan; verifies the amd64 manifest digest is unchanged afterwards.
|
# tag moved since the plan; verifies the amd64 manifest digest is unchanged afterwards.
|
||||||
|
|||||||
+19
-3
@@ -108,11 +108,27 @@ ARG PKG_CACHE=
|
|||||||
COPY ./scripts/pkg-cache-repos.sh /usr/local/sbin/pkg-cache-repos.sh
|
COPY ./scripts/pkg-cache-repos.sh /usr/local/sbin/pkg-cache-repos.sh
|
||||||
COPY ./keys/pkg-cache/ /usr/local/share/pkg-cache/
|
COPY ./keys/pkg-cache/ /usr/local/share/pkg-cache/
|
||||||
COPY ./scripts/lsphp-apt-upgrade.sh /usr/local/sbin/lsphp-apt-upgrade.sh
|
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; \
|
RUN set -e; \
|
||||||
/usr/local/sbin/pkg-cache-repos.sh apt; \
|
/usr/local/sbin/pkg-cache-repos.sh apt; \
|
||||||
/usr/local/sbin/lsphp-apt-upgrade.sh --no-os-upgrade "${PHPVER}" \
|
install_dev() { \
|
||||||
build-essential autoconf pkg-config \
|
/usr/local/sbin/lsphp-apt-upgrade.sh --no-os-upgrade "${PHPVER}" \
|
||||||
lsphp${PHPVER}-dev; \
|
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; \
|
/usr/local/sbin/pkg-cache-repos.sh restore; \
|
||||||
RTV=$(dpkg-query -W -f='${Version}' lsphp${PHPVER}); \
|
RTV=$(dpkg-query -W -f='${Version}' lsphp${PHPVER}); \
|
||||||
DEVV=$(dpkg-query -W -f='${Version}' lsphp${PHPVER}-dev); \
|
DEVV=$(dpkg-query -W -f='${Version}' lsphp${PHPVER}-dev); \
|
||||||
|
|||||||
@@ -21,9 +21,22 @@ apt, noble arm64), not from source, because:
|
|||||||
* the result is checked, not assumed: the workflow runs `scripts/arm64-parity-probe.php` natively in
|
* the result is checked, not assumed: the workflow runs `scripts/arm64-parity-probe.php` natively in
|
||||||
the existing amd64 image and under QEMU in the new arm64 image and FAILS the run (tag untouched)
|
the existing amd64 image and under QEMU in the new arm64 image and FAILS the run (tag untouched)
|
||||||
on any difference in PHP_VERSION, SAPI, the loaded extension list and versions, or any of the
|
on any difference in PHP_VERSION, SAPI, the loaded extension list and versions, or any of the
|
||||||
~350 ini values (with the image's config and with `-n`). It also compares the OpenLiteSpeed
|
~350 ini values, with the image's own config (what customers get) and with no ini at all
|
||||||
|
(compiled-in defaults; one known exception below). It also compares the OpenLiteSpeed
|
||||||
version and module versions (LiteSpeed's per-arch "BUILD built:" stamp is ignored).
|
version and module versions (LiteSpeed's per-arch "BUILD built:" stamp is ignored).
|
||||||
Measured 2026-11-20 on cac-lsphp:php85: 418 lines identical.
|
Measured 2026-11-20 on cac-lsphp:php85: 62/62 extensions and 351/351 effective ini values identical.
|
||||||
|
|
||||||
|
### Known difference: compiled-in `session.upload_progress.enabled`
|
||||||
|
|
||||||
|
LiteSpeed's packaged arm64 lsphp is compiled with `session.upload_progress.enabled=0`; its amd64
|
||||||
|
package reports `1`, and our php.net-source amd64 images copy that `1` on purpose
|
||||||
|
(`lsphp-src-build.sh` step 2c). Both architectures ship `session.upload_progress.enabled = 0` in
|
||||||
|
`zz-php2shell-mitigation.ini`, so the EFFECTIVE value is `0` on both (`php -i` in a running
|
||||||
|
container, the `cfg` probe, which the gate compares with no exception). Only the compiled-in
|
||||||
|
default (visible with no ini files, e.g. `PHP_INI_SCAN_DIR=/nonexistent lsphp -c /nonexistent`)
|
||||||
|
differs, and the gate allows exactly that one directive. If identical compiled-in defaults are ever
|
||||||
|
required, the arm64 image would have to be built from php.net source (the source path would need
|
||||||
|
its step 2c to accept a packaged default of `0`; not done).
|
||||||
|
|
||||||
`EXPECT_LSPHP_PKG` / `EXPECT_PHP_VERSION` come from the arm64 repo index
|
`EXPECT_LSPHP_PKG` / `EXPECT_PHP_VERSION` come from the arm64 repo index
|
||||||
(`scripts/lsphp-repo-version.sh PHPVER arm64`), not the amd64 one.
|
(`scripts/lsphp-repo-version.sh PHPVER arm64`), not the amd64 one.
|
||||||
|
|||||||
Reference in new issue
Block a user