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

[20.10 backport] Fix panic when failing to get DefaultAuthConfig #2959

Merged

Conversation

thaJeztah
Copy link
Member

backport of #2918

fixes #2890 Non-root user "docker login" results in panic SIGSEGV segmentation violation
fixes moby/moby#41771 Command 'docker login' does not work

Commit f32731f (#2818) fixed a potential panic when an error was returned while trying to get existing credentials.

However, other code paths currently use the result of GetDefaultAuthConfig() even in an error condition; this resulted in a panic, because a nil was returned.

We should fix the other code paths to be more resilient, and to not use the result of GetDefaultAuthConfig() if an error occurs, but starting with a minimal patch to fix the immediate issue.

- Description for the changelog

- Fix a panic on `docker login` if no config file is present

Commit f32731f fixed a potential panic
when an error was returned while trying to get existing credentials.

However, other code paths currently use the result of `GetDefaultAuthConfig()`
even in an error condition; this resulted in a panic, because a `nil` was
returned.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit c2820a7)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@codecov-io
Copy link

Codecov Report

Merging #2959 (de40c2b) into 20.10 (48d30b5) will decrease coverage by 0.01%.
The diff coverage is 20.00%.

@@            Coverage Diff             @@
##            20.10    #2959      +/-   ##
==========================================
- Coverage   57.02%   57.00%   -0.02%     
==========================================
  Files         297      297              
  Lines       18666    18668       +2     
==========================================
- Hits        10644    10642       -2     
- Misses       7157     7160       +3     
- Partials      865      866       +1     

Copy link
Contributor

@silvin-lubecki silvin-lubecki left a comment

Choose a reason for hiding this comment

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

LGTM

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.

3 participants