Skip to content

[18.09] Fix panic in display only case for license#1408

Merged
andrewhsu merged 2 commits intodocker:18.09from
dhiltgen:fix_panic
Oct 2, 2018
Merged

[18.09] Fix panic in display only case for license#1408
andrewhsu merged 2 commits intodocker:18.09from
dhiltgen:fix_panic

Conversation

@dhiltgen
Copy link
Contributor

@dhiltgen dhiltgen commented Oct 2, 2018

Prior refactoring passes missed a corner case.

Signed-off-by: Daniel Hiltgen daniel.hiltgen@docker.com

Prior refactoring passes missed a corner case.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
@dhiltgen
Copy link
Contributor Author

dhiltgen commented Oct 2, 2018

I'd like to try to build some unit test coverage for this, but the current structure is making this a bit challenging... I'll see what I can do, but if we're under the gun to get beta1.9 cut, we should consider merging this and revisit the unit coverage in a follow-up.

@codecov-io
Copy link

codecov-io commented Oct 2, 2018

Codecov Report

Merging #1408 into 18.09 will increase coverage by 0.09%.
The diff coverage is 90.9%.

@@            Coverage Diff             @@
##            18.09    #1408      +/-   ##
==========================================
+ Coverage   54.12%   54.21%   +0.09%     
==========================================
  Files         290      290              
  Lines       19303    19306       +3     
==========================================
+ Hits        10447    10466      +19     
+ Misses       8192     8173      -19     
- Partials      664      667       +3

@dhiltgen
Copy link
Contributor Author

dhiltgen commented Oct 2, 2018

Slightly more invasive, but now with unit coverage for the specific failure mode - confirmed running the new test case without the fix hits the panic.

Signed-off-by: Daniel Hiltgen <daniel.hiltgen@docker.com>
Copy link
Contributor

@mavenugo mavenugo left a comment

Choose a reason for hiding this comment

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

LGTM

@thaJeztah thaJeztah changed the title Fix panic in display only case for license [18.09] Fix panic in display only case for license Oct 2, 2018
@thaJeztah thaJeztah added this to the 18.09.0 milestone Oct 2, 2018
Copy link
Collaborator

@tiborvass tiborvass left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewhsu
Copy link
Contributor

I'm able to reproduce the panic without this PR:

$ sudo docker engine activate --display-only
...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x55dfe0ffe166]

goroutine 1 [running]:
github.com/docker/cli/cli/command/engine.runActivate(0x55dfe2c89860, 0xc4203adb00, 0x0, 0x0, 0x0, 0x0, 0x55dfe225ddc0, 0x16, 0x0, 0x0, ...)
        /go/src/github.com/docker/cli/cli/command/engine/activate.go:98 +0x1fd
github.com/docker/cli/cli/command/engine.newActivateCommand.func1(0xc420288c80, 0xc4200c9980, 0x0, 0x1, 0x0, 0x0)
        /go/src/github.com/docker/cli/cli/command/engine/activate.go:52 +0x6f
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).execute(0xc420288c80, 0xc42003a0f0, 0x1, 0x1, 0xc420288c80, 0xc42003a0f0)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:762 +0x46a
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4203b3680, 0xc420307f00, 0x55dfe294e2e0, 0xc420307f10)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:852 +0x30c
github.com/docker/cli/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4203b3680, 0xc4203b3680, 0x55dfe2c4b520)
        /go/src/github.com/docker/cli/vendor/github.com/spf13/cobra/command.go:800 +0x2d
main.main()
        /go/src/github.com/docker/cli/cmd/docker/docker.go:175 +0xde

And verify this PR fixes the issue:

$ sudo ./docker engine activate --display-only
Looking for existing licenses for andrewh5u...
NUM                 OWNER               PRODUCT ID          EXPIRES                         PRICING COMPONENTS
0                   andrewh5u           docker-ee-trial     2018-10-22 01:09:07 +0000 UTC   Nodes:10
...

Copy link
Contributor

@andrewhsu andrewhsu left a comment

Choose a reason for hiding this comment

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

LGTM

@andrewhsu andrewhsu merged commit 984bc74 into docker:18.09 Oct 2, 2018
thaJeztah added a commit that referenced this pull request Nov 14, 2018
Fix panic in display only case for license - forward port #1408 to master
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.

7 participants