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

determine_root_path() isn't quite right for XDG_RUNTIME_DIR and /run/user/{} cases #487

Closed
dgibson opened this issue Nov 23, 2021 · 2 comments · Fixed by #488
Closed

determine_root_path() isn't quite right for XDG_RUNTIME_DIR and /run/user/{} cases #487

dgibson opened this issue Nov 23, 2021 · 2 comments · Fixed by #488

Comments

@dgibson
Copy link
Contributor

dgibson commented Nov 23, 2021

For rootless operation, determine_root_path() will select from one of four options for the root state directory:

  1. $XDG_RUNTIME_DIR
  2. /run/user/<uid>
  3. $HOME/.youki/run
  4. /tmp/youki/<uid>

Options (1) and (2) will often amount to the same thing, since /run/user/<uid> is the default value for $XDG_RUNTIME_DIR on most systems. But, in both these cases we don't include "youki", or a similar tag in the path at all, so state directories for each container will be placed directly underneath the runtime directory.

That doesn't match normal conventions, where each program puts its own subdir under the runtime dir. More importantly, it means that youki list which works by iterating through the subdirectories of the root dir will list unrelated things from other tools as though they were containers.

@utam0k
Copy link
Member

utam0k commented Nov 23, 2021

@dgibson Thanks for your report. The part you pointed out is here, right?
https://github.com/containers/youki/blob/e766310a899fac41766c3e6589fb68f84ac17793/crates/youki/src/main.rs#L136-L174
I didn't know the normal convention.

dgibson added a commit to dgibson/youki that referenced this issue Nov 23, 2021
When using a root state directory from $XDG_RUNTIME_DIR, or from it's
default value of /run/user/<uid>, we don't add a tag specific to youki
to the path.  That means the directories for individual containers
will be placed directly in the general use runtime dir.

That's against normal conventions, and could mean that "youki list"
will see files or directories from other software as if they were
youki managed containers.  Therefore, add "youki" to the base runtime
path from XDG.

fixes youki-dev#487

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
@dgibson
Copy link
Contributor Author

dgibson commented Nov 23, 2021

@dgibson Thanks for your report. The part you pointed out is here, right?

Yes, that's it.

I didn't know the normal convention.

I should clarify - I don't have some special knowledge here, I just looked at what's in that directory on my system, and it appears to be subdivided by the program using it:

$ ls /run/user/1000
bus=         dconf/          doc/    gvfs/   gvfsd-sftp/  ICEauthority  pipewire-0=      pulse/  systemd/
claws-mail/  discord-ipc-0=  gnupg/  gvfsd/  i3/          keyring/      pipewire-0.lock  runc/

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 a pull request may close this issue.

2 participants