Skip to content

Stop copying a walked file's sniff bytes twice - #55

Merged
abrignoni merged 1 commit into
mainfrom
fix/walked-stage-duplicates-head
Sep 10, 2026
Merged

abrignoni merged 1 commit into
mainfrom
fix/walked-stage-duplicates-head

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

A file walked out of an acquisition with no extension in its name is sniffed before it is copied into the case, and the sniff bytes were being written into the copy a second time.

  • The staged copy was 16 bytes longer than the file on the volume.
  • Its recorded md5 and sha256 described that copy, so two identical files came out of one image with different hashes and neither matched the evidence.
  • The size column stayed right, nothing errored, and the images still decoded, so nothing pointed at it.

Named extensions skip the sniff and were never affected, which is why the existing staging test passed. Zip and tar are correct as they are: a zip member re-opens for the copy, and a tar member is copied through the same handle the sniff read from.

Two tests, both red before the change: an extension-less file copies out byte for byte, and two identical files on one volume hash alike.

🤖 Generated with Claude Code

A walked file whose name gives no extension is sniffed before it is staged.
The sniff reads its first 16 bytes from a generator of its own, and the copy
then asks the walker for the file from offset 0, so passing those bytes to
the writer put them in the copy twice.

The copy was 16 bytes longer than the file on the volume and its recorded
md5/sha described the copy, so two identical files on the evidence came out
with different hashes and neither matched the volume. Size stayed right,
nothing errored, and images still decoded.

Named extensions were never affected: they skip the sniff, which is why the
existing staging test passed. Zip members re-open for the copy and tar
members are copied through the handle the sniff read from, so both are
correct as they stand.

Co-Authored-By: Claude Opus 5 <[email protected]>
@abrignoni
abrignoni merged commit 0dcf731 into main Sep 10, 2026
8 checks passed
@abrignoni
abrignoni deleted the fix/walked-stage-duplicates-head branch September 10, 2026 10:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant