fix: Read files in raw mode so flobs preserve every byte - #25
Open
joethorley wants to merge 2 commits into
Open
joethorley wants to merge 2 commits into
joethorley wants to merge 2 commits into
Conversation
`flob()` read files with `readBin(what = "integer")`, which dropped the trailing 1-3 bytes of files whose size is not a multiple of 4 and produced NA elements for the bit pattern 0x80000000, causing `vld_flob()` and `unflob()` to reject the flob. Flobs are now read as raw vectors. Legacy integer flobs remain valid, including those containing NA values. Closes #24 Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This was referenced Sep 30, 2026
Open
This branch has not been deployed
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.
Closes #24
Problem
flob()read files withreadBin(what = "integer", n = size), which:.tar.gzand.xlsxNA_integer_for any 4-byte-aligned chunk equal to00 00 00 80, sovld_flob()returnedFALSEandunflob()errored depending on file contentChanges
flob()reads files withreadBin(what = "raw").vld_exint()/chk_exint()accept raw or integer elements, so legacy integer flobs (e.g. those already stored in databases) remain valid and unflob.NAcheck is dropped, sinceNAis a legitimate bit pattern in legacy integer flobs. This also removes the call to the deprecatedchk::chk_no_missing().flob_objis regenerated as a raw flob. The internalflob_old,flob_nonameandslob_objobjects stay integer-based to keep legacy coverage.?flobdescriptions now say raw-mode instead of integer-mode.NAbit pattern, legacy integer flobs containingNA, and the newchk_flob()error message.Notes
vld_exint()/vld_slob()(R/vld.R) that requires integer elements. It will need the same change to accept raw flobs through its slob path.test-chk.R,test-ext.R,test-flobr.R,test-path.Randtest-tools.Ralso occur onmain. They come from newer chk error messages andtools::file_ext()behaviour (CI: file-extension test failures on main (pre-existing) #19).🤖 Generated with Claude Code