Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions arcup/arcup
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,11 @@ verify_checksum_file() {
error "Checksum file has invalid SHA-256 hash: $checksum_path"
fi

# sha256sum and shasum both print lowercase, but the format accepted above allows
# either case, so fold to lowercase before comparing — otherwise a valid digest
# written in uppercase fails as a mismatch. Same normalization detect_platform uses.
expected_checksum="$(printf '%s' "$expected_checksum" | tr '[:upper:]' '[:lower:]')"

if [[ -n "$expected_name" ]]; then
expected_name="${expected_name#\*}"
expected_name="${expected_name##*/}"
Expand Down
4 changes: 4 additions & 0 deletions arcup/test_arcup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ test_checksum_validation() {
verify_checksum_file "$archive" "$checksum_file" "$archive_name"
pass "valid checksum file passes"

printf '%s %s\n' "$(printf '%s' "$checksum" | tr '[:lower:]' '[:upper:]')" "$archive_name" > "$checksum_file"
verify_checksum_file "$archive" "$checksum_file" "$archive_name"
pass "uppercase checksum digest passes"

printf '%s other-asset.tar.gz\n' "$checksum" > "$checksum_file"
expect_fail "checksum filename mismatch fails" verify_checksum_file "$archive" "$checksum_file" "$archive_name"
}
Expand Down