Skip to content

mkcomposefs: Add a hidden CFS_PARSE_STRICT#340

Merged
cgwalters merged 1 commit intocomposefs:mainfrom
cgwalters:ignore-nonsensical-rdev
Sep 12, 2024
Merged

mkcomposefs: Add a hidden CFS_PARSE_STRICT#340
cgwalters merged 1 commit intocomposefs:mainfrom
cgwalters:ignore-nonsensical-rdev

Conversation

@cgwalters
Copy link
Copy Markdown
Contributor

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.

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>
Copy link
Copy Markdown
Collaborator

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to always have these checks instead of a "strict" mode?

Either way, I am fine with it, LGTM

@cgwalters
Copy link
Copy Markdown
Contributor Author

would it make sense to always have these checks instead of a "strict" mode?

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants