dumpfile: Various canonicalization fixes, limit symlink length#270
Open
cgwalters wants to merge 2 commits intocomposefs:mainfrom
Open
dumpfile: Various canonicalization fixes, limit symlink length#270cgwalters wants to merge 2 commits intocomposefs:mainfrom
cgwalters wants to merge 2 commits intocomposefs:mainfrom
Conversation
Collaborator
Author
|
Prep for #225 also xref composefs/composefs#434 |
The composefs-dump(5) spec leaves several fields unspecified or explicitly ignored. Canonicalize them at parse time so that parsed entries have a single canonical representation regardless of which implementation produced them: - **Directory sizes**: "This is ignored for directories." Drop the size field from Item::Directory, always emit 0. - **Hardlink metadata**: "We ignore all the fields except the payload." Zero uid/gid/mode/mtime and skip xattrs, matching the C parser which bails out early (mkcomposefs.c:477-491). - **Xattr ordering**: The spec doesn't define an order. Sort lexicographically so output is deterministic regardless of on-disk ordering. The parser still accepts any input values for backward compatibility. Assisted-by: OpenCode (Claude Opus 4) Signed-off-by: Colin Walters <walters@verbum.org>
XFS limits symlink targets to 1024 bytes, and since generic Linux containers are commonly backed by XFS, enforce that limit in both the dumpfile parser and the EROFS reader rather than allowing up to PATH_MAX (4096). This also avoids exercising a known limitation in our EROFS reader where symlink data that spills into a non-inline data block (which can happen with long symlinks + xattrs) is not read back correctly. See composefs/composefs#342 for the corresponding C fix for that edge case. Assisted-by: OpenCode (Claude Opus 4) Signed-off-by: Colin Walters <walters@verbum.org>
df709e5 to
6dfb4c4
Compare
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.
Per composefs-dump(5): "SIZE: The size of the file. This is ignored for directories."
Directory sizes are filesystem-specific implementation details (ext4 reports block-aligned sizes, EROFS reports serialized dirent byte counts, btrfs may report 0) and have no portable meaning. No consumer of the dumpfile format uses the directory size field.
Drop the size field from Item::Directory and always emit 0 in both the parser's Display impl and write_directory(). The parser still accepts any numeric value in the size field for backward compat with existing dumpfiles.
Assisted-by: OpenCode (Claude Opus 4)