Compare commits

...
Author SHA1 Message Date
jknapp d4ec8b526c Merge pull request #58: arm64-attach parity defaults [skip ci]
[skip ci]
2026-11-20 15:57:16 +00:00
shadowdaoandClaude Sonnet 5.5 d7141a5e1a arm64-attach: parity probe compiled-in defaults without lsphp -n (prints usage); allow the one known upload_progress default
Run 5816 built cac-lsphp:php85 arm64 fine (ext-build fix, cac_path_parity 10/10) and the effective
parity matched (62/62 extensions, 351/351 ini values) but the `-n` probe only printed lsphp's usage.
Use PHP_INI_SCAN_DIR=/nonexistent + -c /nonexistent for the compiled-in defaults. Measured: the
packaged arm64 lsphp is compiled with session.upload_progress.enabled=0, amd64 with 1; the shipped
ini sets 0 on both, so the effective value is identical. Only that directive may differ.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0185ukXi4YX5FxJGqhi6qab6
2026-11-20 07:57:03 -08:00
jknapp 2c7a04b4d0 Merge pull request #57: lsphp dev empty maintscript [skip ci]
[skip ci]
2026-11-20 15:39:49 +00:00
2 changed files with 35 additions and 9 deletions

No files matched your search

+20 -7
View File
@@ -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; }
if [ "$mode" = cfg ]; then
diff -u "$work/amd/$mode.txt" "$work/out/$mode.txt" || rc=1 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.
+15 -2
View File
@@ -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.