Skip to content

Conversation

@Mashimiao
Copy link

Linux is not always not nil.
If Linux is nil, panic will occur.

Signed-off-by: Ma Shimiao [email protected]

@crosbymichael
Copy link
Member

Instead of having this check everywhere shouldn't we make sure that its non-nil at the beginning?

@Mashimiao
Copy link
Author

You mean change spec object after loading config.json depends on whether Linux{} is set or not ?

@crosbymichael
Copy link
Member

@Mashimiao validate once after we read the spec and if it is nil fail before we start executing.

@Mashimiao
Copy link
Author

Mashimiao commented May 17, 2017 via email

@crosbymichael
Copy link
Member

@Mashimiao oh, ok. Never mind then ;)

linuxSpecific := false
if spec.Linux != nil {
linuxSpecific = true
}
Copy link
Member

Choose a reason for hiding this comment

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

This variable is not necessary since you only use it once. As an aside, the nice way of writing this would be

linuxSpecific := spec.Linux != nil

Copy link
Author

Choose a reason for hiding this comment

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

removed such variable.

@justincormack
Copy link
Contributor

Yes, I noticed this panics recently and hadn't opened an issue yet, it does need fixing...

@justincormack
Copy link
Contributor

A simpler solution would be just to set it if nil to the empty config.

@justincormack
Copy link
Contributor

Needs a rebase.

It would be really nice to fix this as it is a stupid panic and makes testing harder.

Linux is not always not nil.
If Linux is nil, panic will occur.

Signed-off-by: Ma Shimiao <[email protected]>
@Mashimiao Mashimiao force-pushed the panic-fix-nil-linux branch from 7f95893 to daccd7a Compare August 14, 2017 06:19
@Mashimiao
Copy link
Author

@justincormack rebased.

@hqhq hqhq closed this in #1551 Aug 14, 2017
@Mashimiao
Copy link
Author

@hqhq I think we need re-open this PR, because #1551 does not fix Linux nil problem totally.

@crosbymichael
Copy link
Member

@Mashimiao please open a new issue with specifically what is still breaking so we can resolve it. We don't have the information here to go on.

@Mashimiao
Copy link
Author

OK, I submit a new PR #1559 to fix the problem

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 this pull request may close these issues.

4 participants