test/update-policy.sh: make the older copy shorter than the new script
check / check (push) Successful in 13s
check / check (push) Successful in 13s
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
This commit is contained in:
1 parent
d8a4a2733a
commit
e34c7bf42d
1 file changed
+5
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user