diff options
| author | salmonik <salmonik@tuta.io> | 2026-11-15 03:11:22 +0100 |
|---|---|---|
| committer | salmonik <salmonik@tuta.io> | 2026-11-15 03:11:22 +0100 |
| commit | 343f2a8a6148b8004d6f4d74fb779b4f30c9686a (patch) | |
| tree | 2ea1ddab346565309da644517c3478d2a9096e55 /scripts/check-glibc.sh | |
| parent | M0: streaming provider, SSE decoder, mock provider, i686 build gate (diff) | |
| download | agent686-343f2a8a6148b8004d6f4d74fb779b4f30c9686a.tar.gz agent686-343f2a8a6148b8004d6f4d74fb779b4f30c9686a.zip | |
M1-M5: sessions, six tools, approvals, prompt, Ctrl-C, target gate
- append-only JSONL sessions with --continue/--session; reasoning stored, stripped on replay
- read/write/edit/grep/glob + bash with timeout and capped output
- diff-preview approval for the first edit of a session, per-call approval for bash
- system prompt frozen per session with AGENTS.md snapshot and change warning
- SIGINT aborts the turn, second Ctrl-C exits
- glibc gate ignores weak symbols; verified in linux/386 debian:12
- acceptance test (calculator in C) passes on both x86-64 and i386
Diffstat (limited to '')
| -rwxr-xr-x | scripts/check-glibc.sh | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/scripts/check-glibc.sh b/scripts/check-glibc.sh index bb9052f..b02cd75 100755 --- a/scripts/check-glibc.sh +++ b/scripts/check-glibc.sh | |||
| @@ -4,6 +4,10 @@ | |||
| 4 | # The dev host's 32-bit glibc is newer than Debian 12's, so a dependency can | 4 | # The dev host's 32-bit glibc is newer than Debian 12's, so a dependency can |
| 5 | # silently raise the required symbol version. Without this check the failure | 5 | # silently raise the required symbol version. Without this check the failure |
| 6 | # only shows up as "version `GLIBC_2.38' not found" on the target machine. | 6 | # only shows up as "version `GLIBC_2.38' not found" on the target machine. |
| 7 | # | ||
| 8 | # Weak undefined symbols are ignored: they resolve to NULL on older libc and the | ||
| 9 | # code paths using them fall back. Rust's std does this for glibc 2.39's | ||
| 10 | # pidfd_spawnp/pidfd_getpid, for example. | ||
| 7 | set -euo pipefail | 11 | set -euo pipefail |
| 8 | 12 | ||
| 9 | binary=${1:?usage: check-glibc.sh <binary> [ceiling, default 2.36]} | 13 | binary=${1:?usage: check-glibc.sh <binary> [ceiling, default 2.36]} |
| @@ -14,21 +18,31 @@ if [ ! -f "$binary" ]; then | |||
| 14 | exit 2 | 18 | exit 2 |
| 15 | fi | 19 | fi |
| 16 | 20 | ||
| 17 | max=$(readelf -V "$binary" 2>/dev/null \ | 21 | required=$(readelf --dyn-syms --wide "$binary" 2>/dev/null \ |
| 22 | | awk '$5 != "WEAK" { print }' \ | ||
| 23 | | grep -oE 'GLIBC_[0-9]+\.[0-9]+' \ | ||
| 24 | | sed 's/^GLIBC_//' \ | ||
| 25 | | sort -Vu \ | ||
| 26 | | tail -1 || true) | ||
| 27 | weak=$(readelf --dyn-syms --wide "$binary" 2>/dev/null \ | ||
| 28 | | awk '$5 == "WEAK" { print }' \ | ||
| 18 | | grep -oE 'GLIBC_[0-9]+\.[0-9]+' \ | 29 | | grep -oE 'GLIBC_[0-9]+\.[0-9]+' \ |
| 19 | | sed 's/^GLIBC_//' \ | 30 | | sed 's/^GLIBC_//' \ |
| 20 | | sort -Vu \ | 31 | | sort -Vu \ |
| 21 | | tail -1 || true) | 32 | | tail -1 || true) |
| 22 | 33 | ||
| 23 | if [ -z "${max:-}" ]; then | 34 | if [ -z "${required:-}" ]; then |
| 24 | echo "check-glibc: no versioned symbols (statically linked?) — nothing to check" | 35 | echo "check-glibc: no versioned symbols (statically linked?) — nothing to check" |
| 25 | exit 0 | 36 | exit 0 |
| 26 | fi | 37 | fi |
| 27 | 38 | ||
| 28 | echo "check-glibc: max symbol version GLIBC_$max, ceiling GLIBC_$ceiling" | 39 | echo "check-glibc: required GLIBC_$required, ceiling GLIBC_$ceiling" |
| 40 | if [ -n "${weak:-}" ] && [ "$weak" != "$required" ]; then | ||
| 41 | echo "check-glibc: weak GLIBC_$weak (optional, resolves to NULL on older libc)" | ||
| 42 | fi | ||
| 29 | 43 | ||
| 30 | if [ "$(printf '%s\n%s\n' "$ceiling" "$max" | sort -V | tail -1)" != "$ceiling" ]; then | 44 | if [ "$(printf '%s\n%s\n' "$ceiling" "$required" | sort -V | tail -1)" != "$ceiling" ]; then |
| 31 | echo "check-glibc: FAIL — binary needs GLIBC_$max, target has GLIBC_$ceiling" >&2 | 45 | echo "check-glibc: FAIL — binary needs GLIBC_$required, target has GLIBC_$ceiling" >&2 |
| 32 | exit 1 | 46 | exit 1 |
| 33 | fi | 47 | fi |
| 34 | 48 | ||
