From e34c7bf42d0c49c59a4460c2b1c11637a0961e97 Mon Sep 17 00:00:00 2001 From: sneak Date: Wed, 18 Nov 2026 22:01:04 +0000 Subject: [PATCH] test/update-policy.sh: make the older copy shorter than the new script The script moves each fetched file into place so that the running script is replaced, never rewritten in place: rewritten in place, the shell would read the new file's tail as commands. The test's older copy was the new script plus a line, so it was longer, and that tail was empty: writing the files with cat instead of mv left the tests green. The older copy is now the new script without its comment lines, and the test fails without the mv. Model: opus-5-5 --- test/update-policy.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/update-policy.sh b/test/update-policy.sh index 17d67f8..2117218 100755 --- a/test/update-policy.sh +++ b/test/update-policy.sh @@ -33,7 +33,9 @@ PATH="$dir/bin:$PATH" export PATH # new_repo: a repo with one commit, holding only an older copy of the -# script, so that a run must replace the script that is running. +# script that is shorter than the new one. A run that rewrote the running +# script in place, instead of replacing it, would then read the new +# file's last lines as commands and fail. new_repo() { scenario="$1" rm -rf "$dir/repo" @@ -42,8 +44,8 @@ new_repo() { git config user.name test git config user.email test@example.com mkdir script - cp "$PROMPTS/script/update-policy" script/ - echo "# older copy" >> script/update-policy + grep -v '^# ' "$PROMPTS/script/update-policy" > script/update-policy + chmod +x script/update-policy echo own > README.md git add README.md script/update-policy git commit -q -m initial