erofs: Add erofs_to_filesystem to convert EROFS images back to tree::FileSystem#252
Merged
cgwalters merged 4 commits intocomposefs:mainfrom Mar 11, 2026
Merged
erofs: Add erofs_to_filesystem to convert EROFS images back to tree::FileSystem#252cgwalters merged 4 commits intocomposefs:mainfrom
cgwalters merged 4 commits intocomposefs:mainfrom
Conversation
Needed for later commits which want to access the hardlink count conveniently. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Fix write_escaped to escape a bare '-' as '\x2d'. The dumpfile parser uses '-' as the sentinel for empty/none fields, so a symlink target or other field value that is literally '-' would be misinterpreted on parse. The escape function in dumpfile_parse.rs already handled this. Split out write_escaped_raw for xattr values, which must not use the '-' sentinel at all. Previously, an empty xattr value was written as '-' (the empty sentinel), but the parser doesn't apply optional_str to xattr values, so it would be read back as the literal byte 0x2d. This matches the C composefs behavior where xattr values use ESCAPE_EQUAL without ESCAPE_LONE_DASH. Fix the Rust dumpfile parser to match the C parser for hardlink entries: detect the '@' prefix early and skip integer parsing of the remaining numeric fields (nlink, uid, gid, rdev, mtime). The C parser splits all fields as strings first, detects '@', and returns early without ever calling parse_int_field on those values. Our parser was unconditionally parsing them as integers, which unnecessarily rejected '-' placeholders. Add comments cross-referencing C composefs escaping behavior throughout. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Add hash-agnostic proptest strategies that build tree::FileSystem directly, covering hardlinks, all xattr namespaces (including the trusted.overlay.* escape path), binary filenames, binary symlink targets, and all file types. Also add dumpfile round-trip proptests that exercise write_dumpfile → dumpfile_to_filesystem → write_dumpfile, using prop_assume! to skip non-UTF-8 cases that the text-based dumpfile format cannot represent. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
…FileSystem The composefs dumpfile was invented to precisely describe exactly what's in a "composefs EROFS" in a human readable textual fashion. However our internal FileSystem is an efficient in-memory metadata tree which we use in various places. Wire these three things more together by supporting going from EROFS -> FileSystem. By adding proptests that cover this we strengthen test coverage of all of these components together. Assisted-by: OpenCode (Claude claude-opus-4-6) Signed-off-by: Colin Walters <walters@verbum.org>
Collaborator
Author
|
I have to say proptest is so amazing - between that and fuzzing and then onto formal checking there's so many good tools... |
Johan-Liebert1
approved these changes
Mar 11, 2026
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.
Prep for #236