Fix handling of auth.json file while in a user namespace

If you are running buildah within a user namespace, without
XDG_RUNTIME_DIR being set, we need to make sure buildah login, logout
handle XDG_RUNTIME_DIR the same was as buildah push.

Running buildah within a container is triggering failures, where buildah
login puts the auth.json file in /run/containers/0/auth.json but buildah
push looks for it in
/tmp/container-user-0/containers/containers/auth.json

Fixes: https://github.com/containers/buildah/issues/3259

[NO TESTS NEEDED] The existing tests should see if this causes any
problems.

Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
This commit is contained in:
Daniel J Walsh 2021-06-02 10:19:42 -04:00
parent 1192500cf0
commit c5a6950b50
No known key found for this signature in database
GPG Key ID: A2DF901DABE2C028
1 changed files with 1 additions and 1 deletions

View File

@ -132,7 +132,7 @@ func before(cmd *cobra.Command) error {
}
switch cmd.Use {
case "", "help", "version", "mount", "login", "logout":
case "", "help", "version", "mount":
return nil
}
unshare.MaybeReexecUsingUserNamespace(false)