diff --git a/.github/workflows/bake-rootfs.yml b/.github/workflows/bake-rootfs.yml index c99c8163a..5a1647686 100644 --- a/.github/workflows/bake-rootfs.yml +++ b/.github/workflows/bake-rootfs.yml @@ -40,7 +40,7 @@ jobs: timeout-minutes: 30 steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Ensure AWS CLI is available run: aws --version || { sudo apt-get update && sudo apt-get install -y awscli; } @@ -98,14 +98,22 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v5 - name: Ensure AWS CLI is available run: aws --version || { sudo apt-get update && sudo apt-get install -y awscli; } + # NOTE (ADFA-5334 -- fchmodat2 tech debt, address soon): the builder installs the rootfs + # under proot, and this proot does NOT translate the fchmodat2 syscall (glibc>=2.39 / + # kernel>=6.6). Any recursive perms-preserving copy (tar -x, cp -a, rsync -a) then fails + # restoring directory modes -> the install aborts and every tier lands on HOLD. Worked + # around per call site (site-updater: tar --no-same-permissions; iiab-android: cp -a + # --no-preserve=mode). Proper fix: translate fchmodat2 in libproot (PRootEngine) and drop + # these workarounds; until then any NEW perms-preserving copy in the install MUST use the + # proot-safe form. - name: Build all tiers for ${{ matrix.arch }} run: | - sudo ./tools/rootfs-builder/build-iiab-rootfs.sh \ + sudo bash ./tools/rootfs-builder/build-iiab-rootfs.sh \ --all-tier --arch "${{ matrix.arch }}" \ --publish-url "$ROOTFS_PUBLIC_BASE" --reset-mirrors # the builder runs as root; hand dist/ back to the runner so the upload step can read it diff --git a/iiab-android b/iiab-android index faffc1478..ed9adac6f 100644 --- a/iiab-android +++ b/iiab-android @@ -409,7 +409,9 @@ install_demo_contents() { if wget -c "${DEMO_REPO_URL}/${cw_tar}" -O "/tmp/${cw_tar}"; then log "Extracting $cw_tar into $cw_dir..." - tar -xzf "/tmp/${cw_tar}" -C "$cw_dir" + # proot-safe: tar -x as root restores directory modes via fchmodat2, untranslated by this + # proot (same root cause as the ADFA-5334 site-updater) -> it aborts on the dir entries. + tar --no-same-permissions --no-same-owner -xzf "/tmp/${cw_tar}" -C "$cw_dir" rm -f "/tmp/${cw_tar}" else warn "Failed to download Calibre-Web demo library ($cw_tar)" @@ -466,7 +468,9 @@ install_iiaboa_dashboard() { log "Downloading and installing Yarn directly..." mkdir -p /opt/yarn - curl -fsSL --compressed https://yarnpkg.com/latest.tar.gz | tar -xz -C /opt/yarn --strip-components=1 + # proot-safe: tar -x as root restores directory modes via fchmodat2 (untranslated by this proot, + # fails on dirs); --no-same-permissions keeps files' exec bits (umask only) so bin/yarn stays runnable. + curl -fsSL --compressed https://yarnpkg.com/latest.tar.gz | tar --no-same-permissions --no-same-owner -xz -C /opt/yarn --strip-components=1 ln -sf /opt/yarn/bin/yarn /usr/local/bin/yarn ln -sf /opt/yarn/bin/yarnpkg /usr/local/bin/yarnpkg @@ -474,9 +478,12 @@ install_iiaboa_dashboard() { # Copy dashboard files mkdir -p "$dash_dest" - # Proot-safe copy: rsync's lchmod -> fchmodat2 (glibc>=2.39, kernel>=6.6) isn't - # translated by proot (rc=23 under proot on 6.6+ kernels); cp -a is reliable. - cp -a "${dash_src}/." "$dash_dest/" + # Proot-safe copy: rsync's lchmod AND cp -a's mode restore both use fchmodat2 (glibc>=2.39, + # kernel>=6.6), which this proot does NOT translate -> it fails on directory entries (rc=23, + # same root cause as the ADFA-5334 site-updater). --no-preserve=mode drops only that failing + # chmod pass; ownership/timestamps/symlinks are still preserved. FIXME(fchmodat2): see the note + # in .github/workflows/bake-rootfs.yml -- translate fchmodat2 in libproot and drop these. + cp -a --no-preserve=mode "${dash_src}/." "$dash_dest/" # Install node dependencies and compile TS->JS (ADFA-4839: dash-node runs dist/server.js). log "Installing Node dependencies for the dashboard..." @@ -695,7 +702,9 @@ fi # files (removing a build is just dropping it from VERSIONS in fetch-pdfjs.sh). rm -rf /library/www/html/pdfjs/* if [ -f "${K2GO_OPT_DIR}/static/pdfjs/dist/manifest.json" ]; then - cp -a "${K2GO_OPT_DIR}/static/pdfjs/dist/." /library/www/html/pdfjs/ + # proot-safe: cp -a's mode restore uses fchmodat2 (untranslated by this proot, fails on dirs); + # --no-preserve=mode drops only that chmod pass (ADFA-5334, same as the site-updater). + cp -a --no-preserve=mode "${K2GO_OPT_DIR}/static/pdfjs/dist/." /library/www/html/pdfjs/ ok "pdf.js builds deployed: $(sed -n 's/.*\"id\":\"\([^\"]*\)\".*/\1/p' /library/www/html/pdfjs/manifest.json | tr '\n' ' ')" else warn "pdf.js dist not found; viewer will 404 until deployed." diff --git a/static/site/site-updater.sh b/static/site/site-updater.sh index e842ab1d2..0bc9c9d25 100755 --- a/static/site/site-updater.sh +++ b/static/site/site-updater.sh @@ -21,7 +21,11 @@ mkdir -p "$DEST_DIR" # Mirror: clear the destination, then copy via tar (proot-safe). Excludes this script and any *.sh. printf "Mirroring %s -> %s ...\n" "$SITE_SRC" "$DEST_DIR" find "$DEST_DIR" -mindepth 1 -delete 2>/dev/null || true -( cd "$SITE_SRC" && tar --exclude='*.sh' -cf - . ) | ( cd "$DEST_DIR" && tar -xf - ) +# tar -x as root also restores dir/file modes+owner via fchmodat2/fchownat, which this proot +# does NOT translate (same root cause as the rsync->tar switch, ADFA-5059) -> extraction aborted +# on ./js, ./css, ./img, ./lang. Skip that restore pass; the static assets take umask defaults +# (dirs 0755, files 0644) here, which is exactly what nginx serves. +( cd "$SITE_SRC" && tar --exclude='*.sh' -cf - . ) | ( cd "$DEST_DIR" && tar --no-same-permissions --no-same-owner -xf - ) # Cache-bust: stamp ONLY the served index.html (it carries the asset ?v= refs and the runtime token # window.__CACHEBUST__). app.js is intentionally NOT stamped — it reads the token at runtime and diff --git a/tools/rootfs-builder/build-iiab-rootfs.sh b/tools/rootfs-builder/build-iiab-rootfs.sh old mode 100644 new mode 100755