-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Quadlet - make sure the /etc/containers/systemd/users is traversed in rootless #24815
Quadlet - make sure the /etc/containers/systemd/users is traversed in rootless #24815
Conversation
I'm not sure how to test this. The problem is that creating folders under |
That's usually done via env vars. Could you use |
I don't think this can help here, it will not trigger the code path in question here as this does not change the root. I think for testing it may be possible to run quadlet in a container where we can have full control over all dirs or just chroot() may be enough? But it still is no clear to me how we could integrate this into the existing e2e test. |
Yes, @Luap99 is correct. When |
Containerized e2e could be a safe way to test, but not trivial (test fixtures would need to be set up outside the test itself). And, sorry, I can't remember if we run rootless containerized. |
Maybe in the e2e test instead of calling quadlet on the host we can wrap it in a container like this:
Where /tmp/test is the source of the quadlet files, that seems to work and we have full control where to place the files. |
I've tried running this containerized, but I still see issues. While I would like to explore the idea, can we still merge this PR (by skipping the new tests requirement) as it does fix a real issue? |
Yeah if there is no easy way I am fine to bypass the test requirement. Although I just touched the quadlet unit tests and there seems to be some chroot logic in there so maybe something can be done there, thought not sure. |
… rootless Signed-off-by: Ygal Blum <[email protected]>
4c238aa
to
0b3ad66
Compare
@Luap99 Thanks a lot for this pointer. I didn't notice it before. I added some more tests to the unit tests (with some cleanup of code duplication) |
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.
LGTM
createDir := func(path, name string) string { | ||
dirName := filepath.Join(path, name) | ||
err = os.Mkdir(dirName, 0755) | ||
assert.Nil(t, err) |
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.
not blocking as it is pre existing and done in way to many other places but error checks should be done with
assert.NoError()
because that prints a better message when it fails.
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.
Yeah, I just copy pasted the code. I see that it's being fixed in #24974
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Luap99, ygalblum The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/lgtm |
Does this PR introduce a user-facing change?
No
Resolves: #24783