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

Fix segv error for usage error of oc set env command #17932

Merged
merged 1 commit into from
Jan 10, 2018
Merged

Fix segv error for usage error of oc set env command #17932

merged 1 commit into from
Jan 10, 2018

Conversation

nak3
Copy link
Contributor

@nak3 nak3 commented Dec 27, 2017

When oc set env had wrong argments, oc command failed with segv
error.

This patch fixes the issue by passing valid cmd object to
kcmdutil.UsageErrorf.

Note, this segv error could be reproduced by following command.

# ./oc set env foo=bar router
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x100e116]

goroutine 1 [running]:
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).Name(0x0, 0xc421353b58, 0x4ea8c4)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:918 +0x26
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).CommandPath(0x0, 0x3e, 0xc421353c88)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:853 +0x2f
github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util.UsageErrorf(0x0, 0x4d46e38, 0x3e, 0xc421353c88, 0x1, 0x1, 0xe, 0x0)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/vendor/k8s.io/kubernetes/pkg/kubectl/cmd/util/helpers.go:296 +0x8e
github.com/openshift/origin/pkg/oc/cli/cmd/set.(*EnvOptions).Complete(0xc420af38c0, 0xc4211e13b0, 0xc42046e000, 0xc42058d4c0, 0x2, 0x2, 0x4, 0x4ee6158)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/pkg/oc/cli/cmd/set/env.go:173 +0x774
github.com/openshift/origin/pkg/oc/cli/cmd/set.NewCmdEnv.func1(0xc42046e000, 0xc42058d4c0, 0x2, 0x2)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/pkg/oc/cli/cmd/set/env.go:126 +0x6f
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).execute(0xc42046e000, 0xc42058d320, 0x2, 0x2, 0xc42046e000, 0xc42058d320)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:603 +0x234
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xc4204d0900, 0x202d071, 0xc4204d0900, 0xc420374a20)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:689 +0x2fe
github.com/openshift/origin/vendor/github.com/spf13/cobra.(*Command).Execute(0xc4204d0900, 0x2, 0xc4204d0900)
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/vendor/github.com/spf13/cobra/command.go:648 +0x2b
main.main()
	/home/knakayam/dev/origin/_output/local/go/src/github.com/openshift/origin/cmd/oc/oc.go:41 +0x293

@openshift-ci-robot openshift-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Dec 27, 2017
@nak3
Copy link
Contributor Author

nak3 commented Dec 27, 2017

/retest

@imcsk8
Copy link
Contributor

imcsk8 commented Dec 28, 2017

LGTM

Copy link
Contributor

@soltysh soltysh left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 2, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: nak3, soltysh

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these OWNERS Files:

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 2, 2018
@soltysh
Copy link
Contributor

soltysh commented Jan 3, 2018

/retest

@soltysh
Copy link
Contributor

soltysh commented Jan 3, 2018 via email

@soltysh
Copy link
Contributor

soltysh commented Jan 3, 2018 via email

@nak3
Copy link
Contributor Author

nak3 commented Jan 4, 2018

/retest

@soltysh
Copy link
Contributor

soltysh commented Jan 4, 2018 via email

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@soltysh
Copy link
Contributor

soltysh commented Jan 9, 2018

/retest

@soltysh
Copy link
Contributor

soltysh commented Jan 9, 2018 via email

@soltysh
Copy link
Contributor

soltysh commented Jan 10, 2018 via email

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 17932, 18037, 17479, 18051, 18052).

@openshift-merge-robot openshift-merge-robot merged commit 45d3b91 into openshift:master Jan 10, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants