Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contrib/fs-idmap: Minor cleanups #3954

Merged
merged 5 commits into from
Aug 3, 2023

Conversation

rata
Copy link
Member

@rata rata commented Aug 1, 2023

Here are some cleanups to the fs-idmap binary that we use in integration test to detect if a fs supports idmap mounts or not.

These are just minor cleanups, I'm not fixing any real bug we hit nor anything (I'm not aware of any).

cc @eiffel-fl

@rata rata force-pushed the rata/idmap-tests branch 2 times, most recently from 97c0711 to 8cfa68b Compare August 1, 2023 15:04
contrib/cmd/fs-idmap/fs-idmap.go Outdated Show resolved Hide resolved
Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

contrib/cmd/fs-idmap/fs-idmap.go Outdated Show resolved Hide resolved
contrib/cmd/fs-idmap/fs-idmap.go Outdated Show resolved Hide resolved
contrib/cmd/fs-idmap/fs-idmap.go Outdated Show resolved Hide resolved
contrib/cmd/fs-idmap/fs-idmap.go Outdated Show resolved Hide resolved
This is what we should do, although in practice this probably won't be a
big issue as the parent also exits.

While we are there, instead of waiting for the child to finish, kill it
if we did everything we wanted to do.

Signed-off-by: Rodrigo Campos <[email protected]>
@rata rata force-pushed the rata/idmap-tests branch 4 times, most recently from f5dfe17 to 27b4886 Compare August 2, 2023 10:16
@rata rata requested review from cyphar and kolyshkin August 2, 2023 10:18
@rata
Copy link
Member Author

rata commented Aug 2, 2023

@cyphar @kolyshkin All fixed now, PTAL

Copy link
Member

@cyphar cyphar left a comment

Choose a reason for hiding this comment

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

LGTM, though I don't think this change needs 8 commits.

We don't really need to check if AT_RECURSIVE is possible here. We just
want to check if we can idmap the src, it doesn't matter other nested
mounts.

While we are there, allow relative paths too.

Signed-off-by: Rodrigo Campos <[email protected]>
If more args are passed, let's just throw an error.

Signed-off-by: Rodrigo Campos <[email protected]>
Let's just rely on the lookup performed to find the sleep binary.

This didn't cause any issues as far as I know, I just saw this while
doing other cleanups.

Signed-off-by: Rodrigo Campos <[email protected]>
We can't call log.Fatalf() and defer functions, as the former doesn't
call any defers. Let's just move the code to a new function and call
os.Exit() only in main, when all defer executed.

Now that all the code is one function, we only print twice to stderr. It
is simpler to just print to stderr instead of logging and having also
the timestamp we don't really want.

Signed-off-by: Rodrigo Campos <[email protected]>
@rata
Copy link
Member Author

rata commented Aug 2, 2023

@cyphar heh, agreed. Squashed some commits now. Other than that, no changes :)

Copy link
Contributor

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

LGTM

@kolyshkin kolyshkin merged commit cbf8c67 into opencontainers:main Aug 3, 2023
36 checks passed
@kolyshkin
Copy link
Contributor

In fact, this is more than "minor cleanups" -- this allows the tests to be skipped when they are needed to be skipped.

@eiffel-fl
Copy link
Contributor

Thank you for the merge!

@rata rata deleted the rata/idmap-tests branch August 3, 2023 08:11
@rata
Copy link
Member Author

rata commented Aug 3, 2023

@kolyshkin really, how so? Do you happen to know? It was skipping tests before this PR just fine on CI. But I'm glad this helps :)

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

Successfully merging this pull request may close these issues.

4 participants