test(bootstrap): 原子写入残留临时文件的检查改用 glob,shellcheck 不再报 ls | grep

This commit is contained in:
Lemon-miaow committed 2026-09-29 02:28:50 +08:00
1 parent 9b4c9bf4b5
commit 6b5bd7055b
1 file changed
+4 -1
+4 -1
View File
@@ -1775,7 +1775,10 @@ expect "a write that fails halfway leaves the old file whole" \
out="$(run_atomic "sync() { return 1; }; write_file_atomic '$wadir/old.env' 0600 < '$wadir/in.replace'")" out="$(run_atomic "sync() { return 1; }; write_file_atomic '$wadir/old.env' 0600 < '$wadir/in.replace'")"
expect "content that did not reach the disk does not replace the old file" "DIE: could not write $wadir/old.env" "$out" expect "content that did not reach the disk does not replace the old file" "DIE: could not write $wadir/old.env" "$out"
expect "the old file survives a failed sync" "DB_PASSWORD=old-and-whole" "$(cat "$wadir/old.env")" expect "the old file survives a failed sync" "DB_PASSWORD=old-and-whole" "$(cat "$wadir/old.env")"
left="$(cd "$wadir" && ls -a | grep '^old\.env\.' || true)" left=""
for p in "$wadir"/old.env.*; do
if [ -e "$p" ]; then left="$left${left:+ }${p##*/}"; fi
done
if [ -z "$left" ]; then if [ -z "$left" ]; then
echo "PASS a failed write leaves no temp file beside the old one" echo "PASS a failed write leaves no temp file beside the old one"
else else