From a497bb5f81929a32bec77da4b5647871316ab263 Mon Sep 17 00:00:00 2001 From: Tolga Ergin Date: Wed, 25 Nov 2026 11:46:07 +0000 Subject: [PATCH 1/6] Check that Apple, Sigstore and the latest stable's updater still accept releases Installed copies of LPM check each update with code they can never change, against Apple and Sigstore records that keep changing. Nothing watched those from the outside, and nothing checked that a new release is one the updaters already in the field accept. - scripts/ci/previous-stable-update-gate.sh installs the latest stable through the official installer into a throwaway home, serves a release on loopback, and has that stable update itself to it through its own `lpm self-update`. On macOS it hides Xcode and the Command Line Tools once the latest stable no longer needs them. - The release workflow runs it on every candidate and nightly after the installer smoke test, so a release the latest stable's updater would refuse is never published. - The new Release trust workflow runs daily: Apple must still vouch for the current stable and nightly macOS apps (stapler and Gatekeeper, which see revoked tickets and certificates that offline clients can't), Sigstore's live repository must still serve the trust root built into LPM, and the latest stable must update itself to the newest nightly on Linux x64 and arm64 and macOS arm64 and x64. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-trust.yml | 154 ++++++++++++++++++ .github/workflows/release.yml | 13 +- scripts/ci/previous-stable-update-gate.sh | 181 ++++++++++++++++++++++ 3 files changed, 347 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/release-trust.yml create mode 100755 scripts/ci/previous-stable-update-gate.sh diff --git a/.github/workflows/release-trust.yml b/.github/workflows/release-trust.yml new file mode 100644 index 000000000..22147a105 --- /dev/null +++ b/.github/workflows/release-trust.yml @@ -0,0 +1,154 @@ +name: Release trust + +# Installed copies of LPM check every update with code they can never +# change, against keys and records that Apple and Sigstore keep changing. +# These checks watch the published releases from the outside every day: +# +# - Apple still vouches for the current stable and nightly macOS apps: the +# notarization ticket stands and the Developer ID certificate isn't +# revoked. Clients check the stapled ticket offline and can't see either. +# - Sigstore still serves the trust root built into LPM, so releases ship +# Sigstore's current keys. +# - The latest stable updates itself to the newest nightly, so a signing or +# packaging change on main that installed updaters would refuse fails +# here before a stable release carries it. +on: + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + paths: + - 'crates/lpm-cli/assets/sigstore_*' + - 'crates/lpm-cli/src/sigstore_verify/**' + - 'scripts/ci/previous-stable-update-gate.sh' + - 'scripts/ci/with-apple-service-retry.sh' + - '.github/workflows/release-trust.yml' + schedule: + - cron: '17 6 * * *' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: release-trust-${{ github.ref }} + cancel-in-progress: true + +env: + CARGO_INCREMENTAL: '0' + CARGO_PROFILE_DEV_DEBUG: '0' + CARGO_PROFILE_TEST_DEBUG: '0' + +jobs: + apple: + name: Apple vouches for the current macOS apps + if: ${{ !github.event.pull_request.draft }} + runs-on: macos-15 + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Check each current release with Apple + env: + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + tags=$(curl -fsSL --retry 3 https://registry.npmjs.org/-/package/@lpm-registry/cli/dist-tags) + failed=0 + for channel in latest nightly; do + version=$(jq -er --arg channel "$channel" '.[$channel]' <<<"$tags") + release="$RUNNER_TEMP/v$version" + mkdir -p "$release" + gh release download "v$version" --repo lpm-dev/rust-client --dir "$release" \ + --pattern SHA256SUMS.txt --pattern 'lpm-darwin-*.zip' + for archive in "$release"/lpm-darwin-*.zip; do + asset=$(basename "$archive") + (cd "$release" && awk -v asset="$asset" '$2 == asset' SHA256SUMS.txt | shasum -a 256 --check --strict) + unpacked="$RUNNER_TEMP/unpacked/v$version/${asset%.zip}" + mkdir -p "$unpacked" + ditto -x -k "$archive" "$unpacked" + app="$unpacked/LPM CLI.app" + echo "::group::v$version $asset" + if /usr/bin/codesign --verify --strict --verbose=2 "$app" && + scripts/ci/with-apple-service-retry.sh stapler validate "$app" && + /usr/sbin/spctl --assess --type execute --verbose=4 "$app"; then + echo "Apple vouches for v$version $asset" + else + echo "::error::Apple no longer vouches for v$version $asset. Installed copies that update to it, and the installer, will refuse it." + failed=1 + fi + echo "::endgroup::" + done + done + exit "$failed" + + sigstore: + name: Sigstore serves the trust root built into LPM + if: ${{ !github.event.pull_request.draft }} + runs-on: ubuntu-latest + timeout-minutes: 45 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + - uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # master + with: + toolchain: '1.99.1' + - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: release-trust-sigstore-1.99.1-${{ hashFiles('Cargo.lock') }} + restore-keys: release-trust-sigstore-1.99.1- + + - name: Refresh from Sigstore's live repository + run: >- + cargo test --locked -p lpm-cli --bin lpm-rs -- + --ignored --exact + sigstore_verify::trust_store::tests::sigstores_live_repository_serves_the_built_in_trust_root + + previous-stable-updates-to-nightly: + name: Latest stable updates itself to the newest nightly (${{ matrix.runner }}) + if: ${{ !github.event.pull_request.draft }} + strategy: + fail-fast: false + matrix: + include: + - runner: ubuntu-latest + asset: lpm-linux-x64 + - runner: ubuntu-24.04-arm + asset: lpm-linux-arm64 + - runner: macos-15 + asset: lpm-darwin-arm64.zip + - runner: macos-15-intel + asset: lpm-darwin-x64.zip + runs-on: ${{ matrix.runner }} + timeout-minutes: 20 + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Download the newest nightly + env: + ASSET: ${{ matrix.asset }} + GH_TOKEN: ${{ github.token }} + run: | + set -euo pipefail + version=$(curl -fsSL --retry 3 https://registry.npmjs.org/@lpm-registry/cli/nightly | jq -er .version) + release="$RUNNER_TEMP/nightly" + gh release download "v$version" --repo lpm-dev/rust-client --dir "$release" \ + --pattern SHA256SUMS.txt --pattern SHA256SUMS.txt.sigstore --pattern "$ASSET" + commit=$(gh release view "v$version" --repo lpm-dev/rust-client --json targetCommitish --jq .targetCommitish) + { + echo "NIGHTLY_VERSION=$version" + echo "NIGHTLY_COMMIT=$commit" + echo "NIGHTLY_RELEASE=$release" + } >> "$GITHUB_ENV" + + - name: Update the latest stable to it through its own updater + run: >- + scripts/ci/previous-stable-update-gate.sh + "$NIGHTLY_RELEASE" "$NIGHTLY_VERSION" "$NIGHTLY_COMMIT" nightly diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 198a541bc..6921f9e25 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1791,7 +1791,7 @@ jobs: needs.release-metadata.outputs.should_release == 'true' && (needs.release-metadata.outputs.mode == 'candidate' || needs.release-metadata.outputs.mode == 'full') runs-on: ${{ matrix.os }} - timeout-minutes: 15 + timeout-minutes: 30 permissions: actions: read contents: read @@ -1967,6 +1967,17 @@ jobs: if: always() && matrix.platform == 'macos' run: bash scripts/ci/macos-developer-tools.sh restore "$RUNNER_TEMP/developer-tools" + # Installed copies update with the updater they shipped. If the latest + # stable's updater refuses this release, users on it are stranded, so + # the release must not be published. + - name: Update the latest stable to this release through its own updater + env: + RELEASE_CHANNEL: ${{ needs.release-metadata.outputs.channel }} + RELEASE_VERSION: ${{ needs.release-metadata.outputs.version }} + run: >- + scripts/ci/previous-stable-update-gate.sh + staged-release "$RELEASE_VERSION" "$GITHUB_SHA" "$RELEASE_CHANNEL" + seal-candidate: name: Seal stable release candidate needs: diff --git a/scripts/ci/previous-stable-update-gate.sh b/scripts/ci/previous-stable-update-gate.sh new file mode 100755 index 000000000..44f36896e --- /dev/null +++ b/scripts/ci/previous-stable-update-gate.sh @@ -0,0 +1,181 @@ +#!/bin/bash +# Updates the latest published stable LPM to a release served from this +# machine, through that stable's own `lpm self-update`. +# +# Every installed copy updates with the code it shipped, and that code can't +# change afterwards. A release whose signature, manifest or macOS bundle an +# installed updater would refuse strands those users, so the release workflow +# runs this on each candidate before promoting it, and the release trust +# monitor runs it daily on the newest nightly. +# +# The release directory holds the release's GitHub assets: SHA256SUMS.txt, +# SHA256SUMS.txt.sigstore and the platform assets. + +set -euo pipefail + +usage() { + echo "usage: $0 [previous-stable-version]" >&2 + exit 2 +} + +[ "$#" -ge 4 ] && [ "$#" -le 5 ] || usage + +release_dir=$(cd "$1" && pwd) +version=$2 +source_commit=$3 +channel=$4 +previous=${5:-} +repo_root=$(cd "$(dirname "$0")/../.." && pwd) + +# The first stable whose updater needs neither Xcode nor the Command Line +# Tools on macOS. Earlier ones run /usr/bin/stapler, which only Xcode +# provides. +first_version_without_developer_tools=0.89.0 + +case "$channel" in + stable|nightly) ;; + *) usage ;; +esac +if [[ ! "$source_commit" =~ ^[0-9a-f]{40}$ ]]; then + echo "source commit must be a 40-character lowercase Git object ID: $source_commit" >&2 + exit 2 +fi +for asset in SHA256SUMS.txt SHA256SUMS.txt.sigstore; do + if [ ! -f "$release_dir/$asset" ]; then + echo "$release_dir has no $asset" >&2 + exit 2 + fi +done + +if [ -z "$previous" ]; then + previous=$(curl -fsSL --retry 3 https://registry.npmjs.org/@lpm-registry/cli/latest | + python3 -c 'import json, sys; print(json.load(sys.stdin)["version"])') +fi +newer=$(python3 - "$version" "$previous" <<'PY' +import re, sys + +def key(version): + match = re.fullmatch(r"(\d+)\.(\d+)\.(\d+)(?:-(.+))?", version) + if not match: + sys.exit(f"not a release version: {version}") + major, minor, patch, pre = match.groups() + return (int(major), int(minor), int(patch), pre is None, pre or "") + +print("yes" if key(sys.argv[1]) > key(sys.argv[2]) else "no") +PY +) +if [ "$newer" != yes ]; then + echo "$version is not newer than the latest stable, $previous; nothing to update from" >&2 + exit 0 +fi + +work=$(mktemp -d) +server_pid= +developer_tools_hidden= +cleanup() { + if [ -n "$server_pid" ]; then + kill "$server_pid" 2>/dev/null || true + fi + if [ -n "$developer_tools_hidden" ]; then + bash "$repo_root/scripts/ci/macos-developer-tools.sh" restore "$work/developer-tools" || true + fi + rm -rf "$work" +} +trap cleanup EXIT INT TERM + +home="$work/home" +serve="$work/serve" +mkdir -p "$home" "$serve/download/$version" "$serve/release" +cp -p "$release_dir"/* "$serve/download/$version/" + +# The updater checks that the release was published close to when Rekor +# recorded its signature, and from the commit the signature names. +integrated_time=$(python3 - "$release_dir/SHA256SUMS.txt.sigstore" <<'PY' +import json, sys + +def find(value): + if isinstance(value, dict): + if "integratedTime" in value: + return value["integratedTime"] + values = value.values() + elif isinstance(value, list): + values = value + else: + return None + for item in values: + found = find(item) + if found is not None: + return found + return None + +print(int(find(json.load(open(sys.argv[1]))))) +PY +) +published_at=$(python3 -c 'import datetime, sys; print(datetime.datetime.fromtimestamp(int(sys.argv[1]), datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"))' "$integrated_time") +printf '{"name":"@lpm-registry/cli","version":"%s"}\n' "$version" > "$serve/npm.json" +printf '{"tag_name":"v%s","published_at":"%s","target_commitish":"%s"}\n' \ + "$version" "$published_at" "$source_commit" > "$serve/release/$version.json" + +port=$(python3 -c 'import socket; s = socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1])') +python3 -m http.server "$port" --bind 127.0.0.1 --directory "$serve" \ + >"$work/server.log" 2>&1 & +server_pid=$! +base="http://127.0.0.1:$port" +for attempt in $(seq 1 50); do + if curl -fsS -o /dev/null "$base/npm.json" 2>/dev/null; then + break + fi + if [ "$attempt" -eq 50 ]; then + cat "$work/server.log" >&2 + exit 1 + fi + sleep 0.1 +done + +run_isolated() { + env -u LPM_HOME -u LPM_INSTALL_DOWNLOAD_BASE -u LPM_INSTALL_TEST_DOWNLOAD_BASE \ + HOME="$home" LPM_NO_UPDATE_CHECK=1 "$@" +} + +echo "Installing LPM $previous through the official installer" +run_isolated LPM_INSTALL_VERSION="v$previous" LPM_INSTALL_CHANNEL=stable sh "$repo_root/install.sh" +lpm="$home/.lpm/bin/lpm" +actual=$(run_isolated "$lpm" --version) +if [ "$actual" != "lpm $previous" ]; then + echo "the installer installed '$actual', not lpm $previous" >&2 + exit 1 +fi + +if [ "$(uname -s)" = Darwin ] && + [ "$(printf '%s\n%s\n' "$first_version_without_developer_tools" "$previous" | sort -V | head -n 1)" = "$first_version_without_developer_tools" ]; then + # Most users' Macs have neither Xcode nor the Command Line Tools. + bash "$repo_root/scripts/ci/macos-developer-tools.sh" hide none "$work/developer-tools" + developer_tools_hidden=1 +fi + +echo "Updating LPM $previous to $version through its own updater" +update_status=0 +run_isolated \ + LPM_NPM_REGISTRY_URL_OVERRIDE="$base/npm.json" \ + LPM_NPM_NIGHTLY_REGISTRY_URL_OVERRIDE="$base/npm.json" \ + LPM_GITHUB_RELEASES_URL_OVERRIDE="$base/no-release-list" \ + LPM_GITHUB_NIGHTLY_RELEASES_URL_OVERRIDE="$base/no-release-list" \ + LPM_GITHUB_RELEASE_BY_TAG_URL_OVERRIDE="$base/release/{tag}.json" \ + LPM_GITHUB_RELEASE_DOWNLOAD_URL_OVERRIDE="$base/download/{tag}/{file}" \ + "$lpm" self-update --channel "$channel" --refresh || update_status=$? + +if [ -n "$developer_tools_hidden" ]; then + bash "$repo_root/scripts/ci/macos-developer-tools.sh" restore "$work/developer-tools" + developer_tools_hidden= +fi +if [ "$update_status" -ne 0 ]; then + echo "::error::LPM $previous refused to update to $version (exit $update_status). Installed copies would be stranded on $previous." >&2 + exit 1 +fi + +actual=$(run_isolated "$lpm" --version) +if [ "$actual" != "lpm $version" ]; then + echo "::error::LPM $previous reported success, but lpm --version says '$actual', not lpm $version" >&2 + exit 1 +fi +echo "LPM $previous updated itself to $version" From f7e0aa6fd1ef43dca5074b3bd744b10eeb6c41cd Mon Sep 17 00:00:00 2001 From: Tolga Ergin Date: Wed, 25 Nov 2026 12:00:28 +0000 Subject: [PATCH 2/6] Restore developer tools after a partial hide, require a real update, and use real publication times Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-trust.yml | 78 +++++++++++++++----- scripts/ci/previous-stable-update-gate.sh | 87 ++++++++++++++++------- 2 files changed, 120 insertions(+), 45 deletions(-) diff --git a/.github/workflows/release-trust.yml b/.github/workflows/release-trust.yml index 22147a105..c1411f016 100644 --- a/.github/workflows/release-trust.yml +++ b/.github/workflows/release-trust.yml @@ -11,7 +11,8 @@ name: Release trust # Sigstore's current keys. # - The latest stable updates itself to the newest nightly, so a signing or # packaging change on main that installed updaters would refuse fails -# here before a stable release carries it. +# here before a stable release carries it. Until the first nightly after a +# stable release, the stable before it updates to it instead. on: pull_request: types: [opened, synchronize, reopened, ready_for_review] @@ -61,8 +62,13 @@ jobs: mkdir -p "$release" gh release download "v$version" --repo lpm-dev/rust-client --dir "$release" \ --pattern SHA256SUMS.txt --pattern 'lpm-darwin-*.zip' - for archive in "$release"/lpm-darwin-*.zip; do - asset=$(basename "$archive") + for asset in lpm-darwin-arm64.zip lpm-darwin-x64.zip; do + archive="$release/$asset" + if [ ! -f "$archive" ]; then + echo "::error::v$version has no $asset" + failed=1 + continue + fi (cd "$release" && awk -v asset="$asset" '$2 == asset' SHA256SUMS.txt | shasum -a 256 --check --strict) unpacked="$RUNNER_TEMP/unpacked/v$version/${asset%.zip}" mkdir -p "$unpacked" @@ -104,13 +110,16 @@ jobs: restore-keys: release-trust-sigstore-1.99.1- - name: Refresh from Sigstore's live repository - run: >- - cargo test --locked -p lpm-cli --bin lpm-rs -- - --ignored --exact - sigstore_verify::trust_store::tests::sigstores_live_repository_serves_the_built_in_trust_root + run: | + set -euo pipefail + cargo test --locked -p lpm-cli --bin lpm-rs -- --ignored --exact \ + sigstore_verify::trust_store::tests::sigstores_live_repository_serves_the_built_in_trust_root \ + | tee "$RUNNER_TEMP/sigstore-live.log" + # A renamed test would match nothing, and cargo passes an empty run. + grep -q '^test result: ok. 1 passed' "$RUNNER_TEMP/sigstore-live.log" - previous-stable-updates-to-nightly: - name: Latest stable updates itself to the newest nightly (${{ matrix.runner }}) + previous-stable-updates-to-newest: + name: Latest stable updates itself to the newest release (${{ matrix.runner }}) if: ${{ !github.event.pull_request.draft }} strategy: fail-fast: false @@ -131,24 +140,55 @@ jobs: with: persist-credentials: false - - name: Download the newest nightly + - name: Download the release to update to env: ASSET: ${{ matrix.asset }} GH_TOKEN: ${{ github.token }} run: | set -euo pipefail - version=$(curl -fsSL --retry 3 https://registry.npmjs.org/@lpm-registry/cli/nightly | jq -er .version) - release="$RUNNER_TEMP/nightly" - gh release download "v$version" --repo lpm-dev/rust-client --dir "$release" \ + tags=$(curl -fsSL --retry 3 https://registry.npmjs.org/-/package/@lpm-registry/cli/dist-tags) + stable=$(jq -er .latest <<<"$tags") + nightly=$(jq -er .nightly <<<"$tags") + nightly_is_newer=$(python3 - "$nightly" "$stable" <<'PY' + import re, sys + + def key(version): + major, minor, patch, pre = re.fullmatch(r"(\d+)\.(\d+)\.(\d+)(?:-(.+))?", version).groups() + return (int(major), int(minor), int(patch), pre is None, pre or "") + + print("yes" if key(sys.argv[1]) > key(sys.argv[2]) else "no") + PY + ) + if [ "$nightly_is_newer" = yes ]; then + target=$nightly + channel=nightly + previous=$stable + else + # Until the next nightly, the newest one predates the latest + # stable, so check the update to that stable from the one before. + target=$stable + channel=stable + previous=$(gh release list --repo lpm-dev/rust-client --exclude-drafts --exclude-pre-releases \ + --limit 2 --json tagName --jq '.[1].tagName') + previous=${previous#v} + fi + release="$RUNNER_TEMP/release" + gh release download "v$target" --repo lpm-dev/rust-client --dir "$release" \ --pattern SHA256SUMS.txt --pattern SHA256SUMS.txt.sigstore --pattern "$ASSET" - commit=$(gh release view "v$version" --repo lpm-dev/rust-client --json targetCommitish --jq .targetCommitish) + gh release view "v$target" --repo lpm-dev/rust-client --json targetCommitish,publishedAt \ + > "$RUNNER_TEMP/release.json" { - echo "NIGHTLY_VERSION=$version" - echo "NIGHTLY_COMMIT=$commit" - echo "NIGHTLY_RELEASE=$release" + echo "TARGET_VERSION=$target" + echo "TARGET_CHANNEL=$channel" + echo "TARGET_COMMIT=$(jq -er .targetCommitish "$RUNNER_TEMP/release.json")" + echo "TARGET_PUBLISHED_AT=$(jq -er .publishedAt "$RUNNER_TEMP/release.json")" + echo "TARGET_RELEASE=$release" + echo "PREVIOUS_VERSION=$previous" } >> "$GITHUB_ENV" - - name: Update the latest stable to it through its own updater + - name: Update the previous stable to it through its own updater run: >- scripts/ci/previous-stable-update-gate.sh - "$NIGHTLY_RELEASE" "$NIGHTLY_VERSION" "$NIGHTLY_COMMIT" nightly + --previous "$PREVIOUS_VERSION" + --published-at "$TARGET_PUBLISHED_AT" + "$TARGET_RELEASE" "$TARGET_VERSION" "$TARGET_COMMIT" "$TARGET_CHANNEL" diff --git a/scripts/ci/previous-stable-update-gate.sh b/scripts/ci/previous-stable-update-gate.sh index 44f36896e..243d8acd3 100755 --- a/scripts/ci/previous-stable-update-gate.sh +++ b/scripts/ci/previous-stable-update-gate.sh @@ -1,30 +1,52 @@ #!/bin/bash -# Updates the latest published stable LPM to a release served from this -# machine, through that stable's own `lpm self-update`. +# Updates a published stable LPM to a release served from this machine, +# through that stable's own `lpm self-update`. # # Every installed copy updates with the code it shipped, and that code can't # change afterwards. A release whose signature, manifest or macOS bundle an # installed updater would refuse strands those users, so the release workflow # runs this on each candidate before promoting it, and the release trust -# monitor runs it daily on the newest nightly. +# monitor runs it daily on the newest release. # # The release directory holds the release's GitHub assets: SHA256SUMS.txt, # SHA256SUMS.txt.sigstore and the platform assets. +# +# --previous names the stable to update from; the default is npm's latest. +# --published-at gives a published release's real publication time; an +# unpublished candidate is served as published when Rekor recorded its +# signature. set -euo pipefail usage() { - echo "usage: $0 [previous-stable-version]" >&2 + echo "usage: $0 [--previous VERSION] [--published-at RFC3339] " >&2 exit 2 } -[ "$#" -ge 4 ] && [ "$#" -le 5 ] || usage +previous= +published_at= +while [ "$#" -gt 0 ]; do + case "$1" in + --previous) + [ "$#" -ge 2 ] || usage + previous=$2 + shift 2 + ;; + --published-at) + [ "$#" -ge 2 ] || usage + published_at=$2 + shift 2 + ;; + --*) usage ;; + *) break ;; + esac +done +[ "$#" -eq 4 ] || usage release_dir=$(cd "$1" && pwd) version=$2 source_commit=$3 channel=$4 -previous=${5:-} repo_root=$(cd "$(dirname "$0")/../.." && pwd) # The first stable whose updater needs neither Xcode nor the Command Line @@ -47,11 +69,9 @@ for asset in SHA256SUMS.txt SHA256SUMS.txt.sigstore; do fi done -if [ -z "$previous" ]; then - previous=$(curl -fsSL --retry 3 https://registry.npmjs.org/@lpm-registry/cli/latest | - python3 -c 'import json, sys; print(json.load(sys.stdin)["version"])') -fi -newer=$(python3 - "$version" "$previous" <<'PY' +# Prints yes when the first semantic version is newer than the second. +newer_than() { + python3 - "$1" "$2" <<'PY' import re, sys def key(version): @@ -63,25 +83,37 @@ def key(version): print("yes" if key(sys.argv[1]) > key(sys.argv[2]) else "no") PY -) -if [ "$newer" != yes ]; then - echo "$version is not newer than the latest stable, $previous; nothing to update from" >&2 - exit 0 +} + +if [ -z "$previous" ]; then + previous=$(curl -fsSL --retry 3 https://registry.npmjs.org/@lpm-registry/cli/latest | + python3 -c 'import json, sys; print(json.load(sys.stdin)["version"])') +fi +if [ "$(newer_than "$version" "$previous")" != yes ]; then + echo "::error::$version is not newer than $previous, so LPM $previous has nothing to update to" >&2 + exit 1 fi work=$(mktemp -d) +developer_tools="$work/developer-tools" server_pid= developer_tools_hidden= cleanup() { + local status=$? if [ -n "$server_pid" ]; then kill "$server_pid" 2>/dev/null || true fi - if [ -n "$developer_tools_hidden" ]; then - bash "$repo_root/scripts/ci/macos-developer-tools.sh" restore "$work/developer-tools" || true + if [ -n "$developer_tools_hidden" ] && + ! bash "$repo_root/scripts/ci/macos-developer-tools.sh" restore "$developer_tools"; then + # The hidden tools are still under the work directory, so keep it. + echo "::error::developer tools could not be restored; they remain under $developer_tools" >&2 + exit 1 fi rm -rf "$work" + exit "$status" } -trap cleanup EXIT INT TERM +trap cleanup EXIT +trap 'exit 130' INT TERM home="$work/home" serve="$work/serve" @@ -90,8 +122,9 @@ cp -p "$release_dir"/* "$serve/download/$version/" # The updater checks that the release was published close to when Rekor # recorded its signature, and from the commit the signature names. -integrated_time=$(python3 - "$release_dir/SHA256SUMS.txt.sigstore" <<'PY' -import json, sys +if [ -z "$published_at" ]; then + published_at=$(python3 - "$release_dir/SHA256SUMS.txt.sigstore" <<'PY' +import datetime, json, sys def find(value): if isinstance(value, dict): @@ -108,10 +141,11 @@ def find(value): return found return None -print(int(find(json.load(open(sys.argv[1]))))) +integrated = int(find(json.load(open(sys.argv[1])))) +print(datetime.datetime.fromtimestamp(integrated, datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")) PY ) -published_at=$(python3 -c 'import datetime, sys; print(datetime.datetime.fromtimestamp(int(sys.argv[1]), datetime.timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ"))' "$integrated_time") +fi printf '{"name":"@lpm-registry/cli","version":"%s"}\n' "$version" > "$serve/npm.json" printf '{"tag_name":"v%s","published_at":"%s","target_commitish":"%s"}\n' \ "$version" "$published_at" "$source_commit" > "$serve/release/$version.json" @@ -147,10 +181,11 @@ if [ "$actual" != "lpm $previous" ]; then fi if [ "$(uname -s)" = Darwin ] && - [ "$(printf '%s\n%s\n' "$first_version_without_developer_tools" "$previous" | sort -V | head -n 1)" = "$first_version_without_developer_tools" ]; then - # Most users' Macs have neither Xcode nor the Command Line Tools. - bash "$repo_root/scripts/ci/macos-developer-tools.sh" hide none "$work/developer-tools" + [ "$(newer_than "$first_version_without_developer_tools" "$previous")" = no ]; then + # Most users' Macs have neither Xcode nor the Command Line Tools. Set + # before hiding, so a hide that fails partway is still undone. developer_tools_hidden=1 + bash "$repo_root/scripts/ci/macos-developer-tools.sh" hide none "$developer_tools" fi echo "Updating LPM $previous to $version through its own updater" @@ -165,7 +200,7 @@ run_isolated \ "$lpm" self-update --channel "$channel" --refresh || update_status=$? if [ -n "$developer_tools_hidden" ]; then - bash "$repo_root/scripts/ci/macos-developer-tools.sh" restore "$work/developer-tools" + bash "$repo_root/scripts/ci/macos-developer-tools.sh" restore "$developer_tools" developer_tools_hidden= fi if [ "$update_status" -ne 0 ]; then From a0fb44a8806da758b138d13a7744fa0bb0d7c150 Mon Sep 17 00:00:00 2001 From: Tolga Ergin Date: Wed, 25 Nov 2026 12:28:54 +0000 Subject: [PATCH 3/6] Run the update gate in the account's real home, on CI only The updater finds the account's home from the system, not $HOME, and on macOS updates only an app in that home, so the gate failed on every Mac. It now runs only in GitHub Actions, sets the account's ~/.lpm aside beside itself, and puts it back afterwards. The developer tools state lives under RUNNER_TEMP with an always() restore step, python3 must not come from the tools it hides, the server binds its own port, and versions compare by SemVer precedence through scripts/ci/semver-newer.py. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-trust.yml | 16 ++--- .github/workflows/release.yml | 4 ++ scripts/ci/previous-stable-update-gate.sh | 85 ++++++++++++++++------- scripts/ci/semver-newer.py | 25 +++++++ 4 files changed, 93 insertions(+), 37 deletions(-) create mode 100644 scripts/ci/semver-newer.py diff --git a/.github/workflows/release-trust.yml b/.github/workflows/release-trust.yml index c1411f016..19e5a9843 100644 --- a/.github/workflows/release-trust.yml +++ b/.github/workflows/release-trust.yml @@ -20,6 +20,7 @@ on: - 'crates/lpm-cli/assets/sigstore_*' - 'crates/lpm-cli/src/sigstore_verify/**' - 'scripts/ci/previous-stable-update-gate.sh' + - 'scripts/ci/semver-newer.py' - 'scripts/ci/with-apple-service-retry.sh' - '.github/workflows/release-trust.yml' schedule: @@ -149,16 +150,7 @@ jobs: tags=$(curl -fsSL --retry 3 https://registry.npmjs.org/-/package/@lpm-registry/cli/dist-tags) stable=$(jq -er .latest <<<"$tags") nightly=$(jq -er .nightly <<<"$tags") - nightly_is_newer=$(python3 - "$nightly" "$stable" <<'PY' - import re, sys - - def key(version): - major, minor, patch, pre = re.fullmatch(r"(\d+)\.(\d+)\.(\d+)(?:-(.+))?", version).groups() - return (int(major), int(minor), int(patch), pre is None, pre or "") - - print("yes" if key(sys.argv[1]) > key(sys.argv[2]) else "no") - PY - ) + nightly_is_newer=$(python3 -I scripts/ci/semver-newer.py "$nightly" "$stable") if [ "$nightly_is_newer" = yes ]; then target=$nightly channel=nightly @@ -192,3 +184,7 @@ jobs: --previous "$PREVIOUS_VERSION" --published-at "$TARGET_PUBLISHED_AT" "$TARGET_RELEASE" "$TARGET_VERSION" "$TARGET_COMMIT" "$TARGET_CHANNEL" + + - name: Restore developer tools after the update gate + if: always() && runner.os == 'macOS' + run: bash scripts/ci/macos-developer-tools.sh restore "$RUNNER_TEMP/previous-stable-gate-developer-tools" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6921f9e25..3ed3d3fd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1978,6 +1978,10 @@ jobs: scripts/ci/previous-stable-update-gate.sh staged-release "$RELEASE_VERSION" "$GITHUB_SHA" "$RELEASE_CHANNEL" + - name: Restore developer tools after the update gate + if: always() && matrix.platform == 'macos' + run: bash scripts/ci/macos-developer-tools.sh restore "$RUNNER_TEMP/previous-stable-gate-developer-tools" + seal-candidate: name: Seal stable release candidate needs: diff --git a/scripts/ci/previous-stable-update-gate.sh b/scripts/ci/previous-stable-update-gate.sh index 243d8acd3..d8316e3a6 100755 --- a/scripts/ci/previous-stable-update-gate.sh +++ b/scripts/ci/previous-stable-update-gate.sh @@ -15,6 +15,12 @@ # --published-at gives a published release's real publication time; an # unpublished candidate is served as published when Rekor recorded its # signature. +# +# The updater finds the account's home directory from the system, not from +# $HOME, and on macOS updates only an app in that home. So this runs only on +# a disposable CI runner, where it sets the account's ~/.lpm aside and puts +# it back afterwards. Sigstore's trust root is fetched as installed copies +# fetch it. set -euo pipefail @@ -43,6 +49,11 @@ while [ "$#" -gt 0 ]; do done [ "$#" -eq 4 ] || usage +if [ "${GITHUB_ACTIONS:-}" != true ]; then + echo "$0 replaces this account's ~/.lpm while it runs, so it runs only in GitHub Actions" >&2 + exit 2 +fi + release_dir=$(cd "$1" && pwd) version=$2 source_commit=$3 @@ -69,34 +80,29 @@ for asset in SHA256SUMS.txt SHA256SUMS.txt.sigstore; do fi done -# Prints yes when the first semantic version is newer than the second. newer_than() { - python3 - "$1" "$2" <<'PY' -import re, sys - -def key(version): - match = re.fullmatch(r"(\d+)\.(\d+)\.(\d+)(?:-(.+))?", version) - if not match: - sys.exit(f"not a release version: {version}") - major, minor, patch, pre = match.groups() - return (int(major), int(minor), int(patch), pre is None, pre or "") - -print("yes" if key(sys.argv[1]) > key(sys.argv[2]) else "no") -PY + python3 -I "$repo_root/scripts/ci/semver-newer.py" "$1" "$2" } if [ -z "$previous" ]; then previous=$(curl -fsSL --retry 3 https://registry.npmjs.org/@lpm-registry/cli/latest | - python3 -c 'import json, sys; print(json.load(sys.stdin)["version"])') + python3 -I -c 'import json, sys; print(json.load(sys.stdin)["version"])') fi if [ "$(newer_than "$version" "$previous")" != yes ]; then echo "::error::$version is not newer than $previous, so LPM $previous has nothing to update to" >&2 exit 1 fi +account_home=$(python3 -I -c 'import os, pwd; print(pwd.getpwuid(os.geteuid()).pw_dir)') +account_lpm="$account_home/.lpm" work=$(mktemp -d) -developer_tools="$work/developer-tools" +# Beside ~/.lpm, so setting it aside is a rename on the same volume. +set_aside="$account_home/.lpm-set-aside-by-update-gate" +# Under RUNNER_TEMP, so a workflow step can restore the developer tools even +# if this script is killed. +developer_tools="${RUNNER_TEMP:-$work}/previous-stable-gate-developer-tools" server_pid= +account_lpm_claimed= developer_tools_hidden= cleanup() { local status=$? @@ -105,9 +111,15 @@ cleanup() { fi if [ -n "$developer_tools_hidden" ] && ! bash "$repo_root/scripts/ci/macos-developer-tools.sh" restore "$developer_tools"; then - # The hidden tools are still under the work directory, so keep it. echo "::error::developer tools could not be restored; they remain under $developer_tools" >&2 - exit 1 + status=1 + fi + if [ -n "$account_lpm_claimed" ]; then + rm -rf "$account_lpm" + if [ -e "$set_aside" ] && ! mv "$set_aside" "$account_lpm"; then + echo "::error::could not put the account's ~/.lpm back; it is at $set_aside" >&2 + status=1 + fi fi rm -rf "$work" exit "$status" @@ -115,15 +127,23 @@ cleanup() { trap cleanup EXIT trap 'exit 130' INT TERM -home="$work/home" +if [ -e "$set_aside" ]; then + echo "$set_aside already exists: an earlier run didn't put the account's ~/.lpm back" >&2 + exit 1 +fi +if [ -e "$account_lpm" ]; then + mv "$account_lpm" "$set_aside" +fi +account_lpm_claimed=1 + serve="$work/serve" -mkdir -p "$home" "$serve/download/$version" "$serve/release" +mkdir -p "$serve/download/$version" "$serve/release" cp -p "$release_dir"/* "$serve/download/$version/" # The updater checks that the release was published close to when Rekor # recorded its signature, and from the commit the signature names. if [ -z "$published_at" ]; then - published_at=$(python3 - "$release_dir/SHA256SUMS.txt.sigstore" <<'PY' + published_at=$(python3 -I - "$release_dir/SHA256SUMS.txt.sigstore" <<'PY' import datetime, json, sys def find(value): @@ -150,13 +170,23 @@ printf '{"name":"@lpm-registry/cli","version":"%s"}\n' "$version" > "$serve/npm. printf '{"tag_name":"v%s","published_at":"%s","target_commitish":"%s"}\n' \ "$version" "$published_at" "$source_commit" > "$serve/release/$version.json" -port=$(python3 -c 'import socket; s = socket.socket(); s.bind(("127.0.0.1", 0)); print(s.getsockname()[1])') -python3 -m http.server "$port" --bind 127.0.0.1 --directory "$serve" \ +if [ "$(uname -s)" = Darwin ]; then + # The server keeps running while the developer tools are hidden. + python_prefix=$(python3 -I -c 'import sys; print(sys.base_prefix)') + case "$python_prefix" in + /Library/Developer/*|/Applications/Xcode*) + echo "::error::python3 comes from developer tools ($python_prefix), which this gate hides" >&2 + exit 1 + ;; + esac +fi +python3 -I -u -m http.server 0 --bind 127.0.0.1 --directory "$serve" \ >"$work/server.log" 2>&1 & server_pid=$! -base="http://127.0.0.1:$port" +port= for attempt in $(seq 1 50); do - if curl -fsS -o /dev/null "$base/npm.json" 2>/dev/null; then + port=$(sed -n 's/.* port \([0-9][0-9]*\) .*/\1/p' "$work/server.log" | head -n 1) + if [ -n "$port" ] && curl -fsS -o /dev/null "http://127.0.0.1:$port/npm.json" 2>/dev/null; then break fi if [ "$attempt" -eq 50 ]; then @@ -165,15 +195,16 @@ for attempt in $(seq 1 50); do fi sleep 0.1 done +base="http://127.0.0.1:$port" run_isolated() { - env -u LPM_HOME -u LPM_INSTALL_DOWNLOAD_BASE -u LPM_INSTALL_TEST_DOWNLOAD_BASE \ - HOME="$home" LPM_NO_UPDATE_CHECK=1 "$@" + env -u LPM_HOME -u LPM_INSTALL_DOWNLOAD_BASE -u LPM_INSTALL_TEST_DOWNLOAD_BASE -u DEVELOPER_DIR \ + HOME="$account_home" LPM_NO_UPDATE_CHECK=1 "$@" } echo "Installing LPM $previous through the official installer" run_isolated LPM_INSTALL_VERSION="v$previous" LPM_INSTALL_CHANNEL=stable sh "$repo_root/install.sh" -lpm="$home/.lpm/bin/lpm" +lpm="$account_lpm/bin/lpm" actual=$(run_isolated "$lpm" --version) if [ "$actual" != "lpm $previous" ]; then echo "the installer installed '$actual', not lpm $previous" >&2 diff --git a/scripts/ci/semver-newer.py b/scripts/ci/semver-newer.py new file mode 100644 index 000000000..172ce0fd5 --- /dev/null +++ b/scripts/ci/semver-newer.py @@ -0,0 +1,25 @@ +"""Print yes when the first semantic version is newer than the second, by +SemVer 2.0.0 precedence, else no.""" + +import re +import sys + + +def precedence(version): + match = re.fullmatch(r"(\d+)\.(\d+)\.(\d+)(?:-([0-9A-Za-z.-]+))?(?:\+[0-9A-Za-z.-]+)?", version) + if not match: + sys.exit(f"not a semantic version: {version}") + major, minor, patch, prerelease = match.groups() + if prerelease is None: + return (int(major), int(minor), int(patch), 1, ()) + # Numeric identifiers compare as numbers and rank below alphanumeric + # ones; a longer list of equal identifiers ranks higher. + identifiers = tuple( + (0, int(part), "") if part.isdigit() else (1, 0, part) for part in prerelease.split(".") + ) + return (int(major), int(minor), int(patch), 0, identifiers) + + +if len(sys.argv) != 3: + sys.exit("usage: semver-newer.py ") +print("yes" if precedence(sys.argv[1]) > precedence(sys.argv[2]) else "no") From 29bddca48134d47f721cc33979730bc63d96ff27 Mon Sep 17 00:00:00 2001 From: Tolga Ergin Date: Wed, 25 Nov 2026 12:37:51 +0000 Subject: [PATCH 4/6] Run the update gate on the promotion-time signature too Promotion signs the release again, and users get that signature, not the candidate's. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ed3d3fd1..aa5ca7c97 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2181,7 +2181,7 @@ jobs: if: needs.prepare-promotion.result == 'success' && needs.release-metadata.outputs.mode == 'promote' runs-on: ubuntu-latest environment: release - timeout-minutes: 10 + timeout-minutes: 20 permissions: actions: read attestations: write @@ -2239,6 +2239,16 @@ jobs: release-candidate/github-release/SHA256SUMS.txt.sigstore "$SOURCE_SHA" + # Promotion signs the release again, and users get this signature, not + # the candidate's. The candidate's macOS bundles already passed the + # gate and are unchanged. + - name: Update the latest stable to the promoted release through its own updater + env: + RELEASE_VERSION: ${{ needs.release-metadata.outputs.version }} + run: >- + scripts/ci/previous-stable-update-gate.sh + release-candidate/github-release "$RELEASE_VERSION" "$SOURCE_SHA" stable + - name: Upload promotion-time GitHub assets id: github-assets uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2 From acb011d6139c1057fdaa15e91a228093c2c1d0d1 Mon Sep 17 00:00:00 2001 From: Tolga Ergin Date: Wed, 25 Nov 2026 12:59:31 +0000 Subject: [PATCH 5/6] Start the gate's release server on its own port, report silent failures, and install the Sigstore job's build packages The macOS run exited with no message. The server now writes the port it bound, startup failures print the server's log, and an ERR trap names the failing line. The Sigstore job installs pkg-config and libdbus-1-dev like the other Linux builds. Co-Authored-By: Claude Opus 5.5 --- .github/workflows/release-trust.yml | 3 +++ scripts/ci/previous-stable-update-gate.sh | 31 +++++++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/.github/workflows/release-trust.yml b/.github/workflows/release-trust.yml index 19e5a9843..3f16bd019 100644 --- a/.github/workflows/release-trust.yml +++ b/.github/workflows/release-trust.yml @@ -110,6 +110,9 @@ jobs: key: release-trust-sigstore-1.99.1-${{ hashFiles('Cargo.lock') }} restore-keys: release-trust-sigstore-1.99.1- + - name: Install Linux build dependencies + run: bash scripts/ci/install-apt-packages.sh pkg-config libdbus-1-dev + - name: Refresh from Sigstore's live repository run: | set -euo pipefail diff --git a/scripts/ci/previous-stable-update-gate.sh b/scripts/ci/previous-stable-update-gate.sh index d8316e3a6..246e10f0f 100755 --- a/scripts/ci/previous-stable-update-gate.sh +++ b/scripts/ci/previous-stable-update-gate.sh @@ -22,7 +22,8 @@ # it back afterwards. Sigstore's trust root is fetched as installed copies # fetch it. -set -euo pipefail +set -Eeuo pipefail +trap 'echo "::error::$(basename "$0") failed at line $LINENO: $BASH_COMMAND" >&2' ERR usage() { echo "usage: $0 [--previous VERSION] [--published-at RFC3339] " >&2 @@ -180,21 +181,35 @@ if [ "$(uname -s)" = Darwin ]; then ;; esac fi -python3 -I -u -m http.server 0 --bind 127.0.0.1 --directory "$serve" \ - >"$work/server.log" 2>&1 & +# The server binds its own port and writes it to a file, so nothing else can +# take the port between choosing and binding it. +python3 -I - "$serve" "$work/port" >"$work/server.log" 2>&1 <<'PY' & +import functools, http.server, os, sys + +handler = functools.partial(http.server.SimpleHTTPRequestHandler, directory=sys.argv[1]) +server = http.server.ThreadingHTTPServer(("127.0.0.1", 0), handler) +with open(sys.argv[2] + ".partial", "w") as port_file: + port_file.write(str(server.server_address[1])) +os.replace(sys.argv[2] + ".partial", sys.argv[2]) +server.serve_forever() +PY server_pid=$! port= -for attempt in $(seq 1 50); do - port=$(sed -n 's/.* port \([0-9][0-9]*\) .*/\1/p' "$work/server.log" | head -n 1) - if [ -n "$port" ] && curl -fsS -o /dev/null "http://127.0.0.1:$port/npm.json" 2>/dev/null; then - break +for attempt in $(seq 1 100); do + if [ -s "$work/port" ]; then + port=$(cat "$work/port") + if curl -fsS -o /dev/null "http://127.0.0.1:$port/npm.json" 2>/dev/null; then + break + fi fi - if [ "$attempt" -eq 50 ]; then + if [ "$attempt" -eq 100 ] || ! kill -0 "$server_pid" 2>/dev/null; then + echo "::error::the release server didn't start (port: ${port:-none})" >&2 cat "$work/server.log" >&2 exit 1 fi sleep 0.1 done +echo "Serving v$version on 127.0.0.1:$port" base="http://127.0.0.1:$port" run_isolated() { From 6a2c546bf1e675ce3d53bb3f12f56251a190556a Mon Sep 17 00:00:00 2001 From: Tolga Ergin Date: Wed, 25 Nov 2026 13:02:54 +0000 Subject: [PATCH 6/6] Run the gate's release server from a file and report why it didn't start On macos-15-intel the server never wrote its port. It now runs from a script file with stdin closed, gets 30 seconds to start, and a failure prints the python3 used, the server process and its log. Co-Authored-By: Claude Opus 5.5 --- scripts/ci/previous-stable-update-gate.sh | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/ci/previous-stable-update-gate.sh b/scripts/ci/previous-stable-update-gate.sh index 246e10f0f..59b6a6486 100755 --- a/scripts/ci/previous-stable-update-gate.sh +++ b/scripts/ci/previous-stable-update-gate.sh @@ -183,7 +183,7 @@ if [ "$(uname -s)" = Darwin ]; then fi # The server binds its own port and writes it to a file, so nothing else can # take the port between choosing and binding it. -python3 -I - "$serve" "$work/port" >"$work/server.log" 2>&1 <<'PY' & +cat >"$work/serve.py" <<'PY' import functools, http.server, os, sys handler = functools.partial(http.server.SimpleHTTPRequestHandler, directory=sys.argv[1]) @@ -193,18 +193,24 @@ with open(sys.argv[2] + ".partial", "w") as port_file: os.replace(sys.argv[2] + ".partial", sys.argv[2]) server.serve_forever() PY +python3 -I "$work/serve.py" "$serve" "$work/port" "$work/server.log" 2>&1 & server_pid=$! port= -for attempt in $(seq 1 100); do +for attempt in $(seq 1 300); do if [ -s "$work/port" ]; then port=$(cat "$work/port") if curl -fsS -o /dev/null "http://127.0.0.1:$port/npm.json" 2>/dev/null; then break fi fi - if [ "$attempt" -eq 100 ] || ! kill -0 "$server_pid" 2>/dev/null; then + if [ "$attempt" -eq 300 ] || ! kill -0 "$server_pid" 2>/dev/null; then echo "::error::the release server didn't start (port: ${port:-none})" >&2 - cat "$work/server.log" >&2 + { + echo "python3: $(command -v python3) ($(python3 --version 2>&1))" + ps -o pid,stat,etime,command -p "$server_pid" || echo "the server process has exited" + echo "server log:" + cat "$work/server.log" + } >&2 exit 1 fi sleep 0.1