mkcomposefs: Add a hidden CFS_PARSE_STRICT #340
Merged
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.
Right now in some cases we have "loose" semantics; a simple case I noticed earlier is we accepted whatever input size for a symlink but ignored it.
I also noticed we accepted (and ignored) a nonzero rdev for a non-device.
We have prior cases around missing trailing newline, etc.
In preparation for a more official "mkcomposefs --strict" mode, add a hidden environment variable and use it to validate some of the above.
There's other bits missing though - for example in strict mode I'd like to hard require that the xattrs are already in canonical form (sorted, no duplicates).
This touches on a general topic that there's "strict" and then something even stronger around "normal form" where we disallow any ambiguous input such as duplicate
//
in filenames etc.That'd be a good bit more work. For now let's just lay the groundwork for stricter validation.