fix(arcup): accept a checksum file with no trailing newline - #418
Closed
erkancamli wants to merge 2 commits into
Closed
erkancamli wants to merge 2 commits into
erkancamli wants to merge 2 commits into
Conversation
verify_checksum_file decided the file was empty from the exit status of read, which reports failure at EOF even when it populated the variables. A checksum file with no trailing newline is a valid single-line file, so inspect the parsed value instead. Also guards an unreadable or missing checksum path, which previously leaked a raw bash redirection error and then aborted on an unbound variable under set -u. Bumps ARCUP_INSTALLER_VERSION to 0.2.1, as the header comment requires: self_update gates on version_gt, so an equal version means every existing install refuses the fix as already up to date.
Five cases: a file with no trailing newline, a bare checksum with neither filename nor newline, an empty file, a blank first line, and a missing file. The three failing cases assert the error message, not just a non-zero exit. Without that they pass on main too, for the wrong reasons, and the new unreadable-file guard would have no coverage at all: removing it makes the missing-file case fail with the raw bash redirection error and a set -u abort, which is exactly what it prevents. 30/30 pass on bash 5.2.
erkancamli
requested review from
ZhiyuCircle,
ancazamfir,
romac and
sergio-mena
as code owners
September 16, 2026 08:11
Contributor
|
Hi @erkancamli, Thank you for your interest in contributing to Arc Node. This PR has been automatically closed because it does not reference a GitHub issue. All PRs must reference an existing issue using the format To contribute properly:
Please see our CONTRIBUTING.md for more details. |
This was referenced Sep 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reopened from #402 so that every commit carries a verified signature. #402's first two commits were pushed unsigned, and this repo requires verified signatures to merge, so that branch could not be fixed in place. The change is identical; the two files are byte for byte what #402 ended with.
What is wrong
verify_checksum_filedecides whether the checksum file is empty from the exit status ofread(arcup/arcup:659on main):readreturns non-zero at EOF even when it populated the variables, which is exactly what happens for a single line with no trailing newline. On bash 5.2.21:So a valid checksum file is rejected as empty, and the operator is told the file is empty when it is not.
The fix
Inspect the parsed value rather than the exit status. Also guards an unreadable or missing checksum path, which previously leaked a raw redirection error and then aborted on an unbound variable under
set -u:ARCUP_INSTALLER_VERSIONgoes to0.2.1, as the header comment atarcup/arcup:7-8requires.self_updategates onversion_gt "$remote_version" "$ARCUP_INSTALLER_VERSION"(lines 423 and 452), so leaving it at0.2.0would make every existing install answer "Arcup is already up to date" and never pick the fix up.Reachability, stated plainly
No official release can trigger this.
scripts/release-package.sh:31-34writes the checksum withsha256sumorshasum -a 256, both of which always emit a trailing newline, andarcuphas no offline install mode. The reachable cases areARC_REPOpointing at a third-party release, or a mirror serving its own assets throughGITHUB_API_URL.On the official path the user-visible win is the second half: an unreadable or missing checksum file now produces one clear message instead of two confusing ones.
Tests
Five cases in
arcup/test_arcup.sh: no trailing newline, a bare checksum with neither filename nor newline, an empty file, a blank first line, and a missing file. 30/30 pass on bash 5.2.21.The three failing cases assert the message, not just a non-zero exit. That matters: all three also fail on
main, for the wrong reasons, so without the message assertion they would be characterization tests and the new-rguard would have no coverage at all. Removing only that guard makes the missing-file case fail with the raw bash error above, which is what it prevents.shellcheck -S stylereports the same three pre-existing SC2030/SC2031 infos asmain, nothing new. Note thatarcup/test_arcup.shis not wired into any workflow; I ran it by hand.Happy to split the unreadable-file guard into its own PR if you would rather keep this one to the newline change.