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.
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
gh-95023: Added os.setns and os.unshare to easily switch between namespaces on Linux #95046
gh-95023: Added os.setns and os.unshare to easily switch between namespaces on Linux #95046
Changes from 28 commits
0bdd8bc
3685a27
8f22740
5115c8a
8845a86
d7bb582
987613a
4c91413
7d23963
b7abf20
af74db5
5181126
3a37ac2
1386833
ae4b661
57b2c84
b2df7f7
b4a68b6
dc51d01
5a3cff5
1d45196
84c4b8c
b9d3a34
51c60d4
225e06b
fb64bb7
01d4af4
15e6d8b
375165b
7e2b44c
3ae952c
432d274
afa9a00
54c7bce
01713ec
a6bb345
1c0fb83
dac402a
ff7f961
cc44f01
58bc8a6
b14396e
50c4809
de7dd3d
5c1bbdd
29129d9
94883a4
3e365d2
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to move these checks inside the child process code. I don't think that skipping the test if unshare() or setns() fails matters. Just exit the child process early with a success (exit code 0, well, just exit) if you get one of these errors, no? If the child process must always succeed, you can use test.suppot.script_helper.assert_python_ok() which captures stdout and stderr and raises an exception with all data if the process fails.
Maybe it would make sense to add a
except PermissionError:
instead. Would you mind to add a comment explaining why/how PermissionError can happen?ENOSPC is expected on unshare() if we exceed some limits on namespaces? If it can only happen on unshare(), maybe add a try/except only on this function call?
Why is EINVAL expected? Can it be raised if there is a bug in the test? Or can it be raised depending on the kernel configuration?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool! did not know about
assert_python_ok
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EINVAL
could be raised the kernel was not configured with theCONFIG_UTS_NS
option.Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.