Repository navigation
Fix blake3 - #31
Merged
Merged
Fix blake3#31
Conversation
processReadFileParallel, used for files over 200KB up to --stream-size (1MB by default) when not using --hash all, had no blake3 branch so the hash was silently empty. This affects the released 1.4.0. Also fix a data race on a shared start time used for trace output. Adds tests checking every hash agrees across the serial, parallel and scanner paths. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Files which cannot be opened, read or walked are reported and the remaining files still processed, then hashit exits non zero, as md5sum does. Previously unreadable and missing files exited 0 - Directories supplied using --input are reported rather than hashed as an empty file - Unknown --format and --hash values are an error rather than silently falling back to text or skipping the hash - --vv includes everything -v outputs, previously an audit with only --vv showed matched files but not modified, moved, new or missing - Debug, trace and verbose output goes to stderr so it does not mix with sum, hashdeep and other output - A .b2 or .blake2b sum file can contain blake2b-256, as written by b2sum -l 256, which previously never verified - SQLite tests in test-all.sh clear their directories first so an aborted run does not break the next Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- README: go install instructions, sqlc generated files location, the current --help output, examples which run as written (hashdeep needs -l for relative paths, write checksum files outside the directory), current file counts, sum extensions, SQLite memory use, exit codes, stdin and multiple argument behaviour, and a working Python example - Help text for -r, -v, --vv, --no-stream, --stream-size and -M describes what they do, and fixes a typo in -i - Messages where processing continues are labelled WARN not ERROR - Trace output names the function actually used - Remove stale comments from test-hashdeep.sh, all of its tests pass Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes found by checking every claim in the README and help text against the code.
Blake3 missing for files between 200KB and the stream size
Files over 200KB up to
--stream-size(1MB by default) are hashed byprocessReadFileParallelwhen not using--hash all. It had no blake3 branch, so the hash was silently empty:hashit -c blake3printedno hash and JSON omitted the field. Audits were also weakened, as an empty hash is skipped when comparing.
This affects the released 1.4.0.
Also fixes a data race in the same function, where every goroutine wrote to a shared start time used for trace output. The race detector reported 7 races before the change and none after.
Adds a unit test checking every hash is produced and agrees across the serial, parallel and scanner paths. It fails on the old code.
test-all.shnow checks every hash on a 300KB file against streamedprocessing.
Error handling and validation
--inputare reported, rather than hashed as an empty file (d41d8cd9…).--formatand--hashvalues are an error listing the valid options, rather than silently falling back to text or skipping the hash.--vvincludes everything-voutputs. Previously an audit with only--vvlisted matched files but not modified, moved, new or missing ones.WARNrather thanERROR..b2or.blake2bsum file can contain blake2b-256, as written byb2sum -l 256, which previously never verified.README and help text
go install github.com/boyter/hashit@latest, asgo getno longer works outside a module.processor/database, notprocessor/db.--helpoutput is pasted from the current build.hashdeepneeds-l(and-vfor the counts) to audit hashit's relative paths.-ronly mattering with multiple pathsmd5sum *not including subdirectories./, opens the database read-only, hashes in chunks, and handles a missing sha256 column. Previously it could crash on a bad database path andcreated an empty database file for a mistyped path.
-r,-v,--vv,--no-stream,--stream-sizeand-Mdescribes what they actually do, and fixes a typo in-i.test-hashdeep.share removed, as all of its tests now pass.Behaviour changes for release notes
--formatand--hashvalues are an error.WARN.Testing
test-all.shandtest-hashdeep.shpass in full, andgo test -race ./processoris clean. New tests cover the blake3 paths, the input file with a directory and a missing file, unknown hashes and formats,debug output on stderr,
--vvaudits, andb2sum -l 256. The SQLite tests intest-all.shnow clear their directories first, so an aborted run no longer breaks the next.