Skip to content

Conversation

@cgwalters
Copy link
Contributor

tests: Fix extra - in should-fail tests

I had an extra - at the end here which was being interpreted
as an xattr...It turns out that mkcomposefs is liberal here
in what it accepts (string parsing in C stinks) and interprets
a missing = to be an xattr with the provided name, and
no value.

In this specific case that's an xattr with the name -.

The Rust parser is stricter and rejects this (which I think
is a good thing), and this is preparation for doing stronger
verification on the Rust side before we start passing data
into C.

Signed-off-by: Colin Walters walters@verbum.org


rust: Also test we fail to parse the should-fail- cases

This way, callers of the Rust API get validation before
we start passing things down to the C code.
(To be clear, the C code also needs sanity tests, but
it's way more reliable to test things on the Rust side)

Signed-off-by: Colin Walters walters@verbum.org


I had an extra `-` at the end here which was being interpreted
as an xattr...It turns out that `mkcomposefs` is liberal here
in what it accepts (string parsing in C stinks) and interprets
a missing `=` to be an xattr with the provided name, and
no value.

In this *specific* case that's an xattr with the name `-`.

The Rust parser is stricter and rejects this (which I think
is a good thing), and this is preparation for doing stronger
verification on the Rust side before we start passing data
into C.

Signed-off-by: Colin Walters <walters@verbum.org>
This way, callers of the Rust API get validation before
we start passing things down to the C code.
(To be clear, the C code also needs sanity tests, but
 it's way more reliable to test things on the Rust side)

Signed-off-by: Colin Walters <walters@verbum.org>
),
(
"no ftype",
include_str!("../../../tests/assets/should-fail-no-ftype.dump"),
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note I didn't need to change the Rust side for this one, it was already strictly validating the mode 🏆

@cgwalters cgwalters enabled auto-merge August 19, 2024 17:53
@cgwalters cgwalters merged commit 8e9ea44 into composefs:main Aug 20, 2024
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