mkcomposefs: Add a hidden CFS_PARSE_STRICT#340
Conversation
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. Signed-off-by: Colin Walters <walters@verbum.org>
giuseppe
left a comment
There was a problem hiding this comment.
would it make sense to always have these checks instead of a "strict" mode?
Either way, I am fine with it, LGTM
The thing that has me hesitant is we know (from PRs and issues here) that there are a set of composefs users who are working today, and I want to avoid breaking them. See e.g. #327 (comment) where John (correctly) argued to accept the no-newline case - which I explicitly switched back to denying in strict mode here. We can ask composefs users to try out "strict mode" in the future and maybe then consider turning it on by default...or probably before that, just emitting warnings in non-strict mode if we find strict mode violations, etc. |
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.