fix: verify-build's dist walk is line-delimited, so a path with trailing whitespace escapes the unlisted-bundle check #223
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
check_unlisted_bundlesinscript/verify-buildwalksdist/throughwhile read -r _file. Two paths escape the check entirely and the script still reports success:dist/chrome/src/popup/index.jswith a trailing space — unlisted and carrying a marker.read -rstrips the trailing blank, the remnant matches a manifest line,is_listedreturns 0, and the real file is never checked. Exit 0,verify-build: 4 bundle(s) verified autistmask-build-debug=off.findprints two lines; line 1 is a listed path and line 2 is empty, hitting the[ -n "$_file" ] || continueguard. Exit 0, same message.Both are pre-existing — they reproduce identically against the pre-fix script — and #180 explicitly recorded whitespace-bearing paths as considered and rejected, so the review of #203 correctly did not fail on them.
Filing anyway for one reason: that PR added a comment asserting "Every file under
dist/is searched", and made the whole-tree walk load-bearing by removing the*.jsfilter. The claim is now untrue for these paths, and a future reader will rely on it. Either the walk becomes exhaustive or the comment stops promising that it is.Not reachable from the failure mode the guard defends — esbuild will not emit such a name — so this is about the guard being honest, not about a live exposure.
Implementation requirements
find dist \( -type f -o -type l \) -print0fed throughxargs -0or-exec sh -c, so no path can be reshaped by field splitting.findnon-zero status guard, the symlink handling, andhas_marker/is_listed's exit-2 treatment.dist/itself with a symlink reduces the walk to a single entry and skips the cross-check — it currently fails closed only because GNUgrepreturns 2 on a directory. That holds onnode:22-slimbut is nowhere asserted. Make it explicit rather than incidental.Definition of done
dist/chrome/src/popup/index.js(trailing space) carrying a marker makesscript/verify-buildexit non-zero.dist/replaced by a symlink fails for a stated reason the script itself checks, not as a side effect ofgrep's directory behaviour.sh,sh -nanddash -nclean.TODO.mdupdated in the same commit.make checkpasses.