3
26
Fork
You've already forked mere
1

Stop collapsing getFileHash errors to a generic FileSystem error #108

Merged
jhuntwork merged 1 commit from sign-getfilehash-error-mapping into main 2026年07月10日 18:41:38 +02:00

getFileHash's catch on hash.calculateFileHash mapped every possible
error - including OutOfMemory and PermissionDenied - to a generic
SignError.FileSystem, discarding the specific error calculateFileHash
had already computed. This backs defaultSigner (used when signing repo
databases), and repository.zig/repo_history.zig have explicit
PermissionDenied/OutOfMemory handling for this exact call that could
never actually trigger because the specific error never survived
getFileHash.

calculateFileHash's HashError (OutOfMemory/FileSystem/PermissionDenied/
InvalidInput) is fully contained within SignError, so the fix is to
just propagate the error directly instead of remapping it - the
AccessDenied/EndOfStream/Unexpected branches being collapsed over were
already dead code, since HashError can never produce them.

getFileHash's catch on hash.calculateFileHash mapped every possible error - including OutOfMemory and PermissionDenied - to a generic SignError.FileSystem, discarding the specific error calculateFileHash had already computed. This backs defaultSigner (used when signing repo databases), and repository.zig/repo_history.zig have explicit PermissionDenied/OutOfMemory handling for this exact call that could never actually trigger because the specific error never survived getFileHash. calculateFileHash's HashError (OutOfMemory/FileSystem/PermissionDenied/ InvalidInput) is fully contained within SignError, so the fix is to just propagate the error directly instead of remapping it - the AccessDenied/EndOfStream/Unexpected branches being collapsed over were already dead code, since HashError can never produce them.
Stop collapsing getFileHash errors to a generic FileSystem error
All checks were successful
/ test (pull_request) Successful in 6m36s
05a82d3bbb
getFileHash's catch on hash.calculateFileHash mapped every possible
error - including OutOfMemory and PermissionDenied - to a generic
SignError.FileSystem, discarding the specific error calculateFileHash
had already computed. This backs defaultSigner (used when signing repo
databases), and repository.zig/repo_history.zig have explicit
PermissionDenied/OutOfMemory handling for this exact call that could
never actually trigger because the specific error never survived
getFileHash.
calculateFileHash's HashError (OutOfMemory/FileSystem/PermissionDenied/
InvalidInput) is fully contained within SignError, so the fix is to
just propagate the error directly instead of remapping it - the
AccessDenied/EndOfStream/Unexpected branches being collapsed over were
already dead code, since HashError can never produce them.
jhuntwork deleted branch sign-getfilehash-error-mapping 2026年07月10日 18:41:39 +02:00
Sign in to join this conversation.
No reviewers
Labels
Clear labels
No items
No labels
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
merelinux/mere!108
Reference in a new issue
merelinux/mere
No description provided.
Delete branch "sign-getfilehash-error-mapping"

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?