-
Notifications
You must be signed in to change notification settings - Fork 553
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
Remove string pointers #653
Conversation
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
Not sure if this is an issue or not but wanted to mention it in case there's a hidden issue.... but the pointer allowed for the receiving side to know when the sender didn't mention the property at all vs they specified "". This is useful when you need to know when the user wants the default value (not mentioned) vs they explicitly want an empty string as the value. Just thought I'd mention it. |
none of those fields look like they would have an issue with this, but others would know for sure. |
On Thu, Jan 12, 2017 at 10:06:22AM -0800, Mrunal Patel wrote:
An empty string works as null value for strings so we don't need
string pointers.
You'll also want the schema change from #548. And probably a note in
the style.md section to avoid folks re-introducing *string in the
future.
|
On Thu, Jan 12, 2017 at 10:17:00AM -0800, Doug Davis wrote:
This is useful when you need to know when the user wants the default
value (not mentioned) vs they explicitly want an empty string as the
value.
This had been the initial motivation for consistently using pointers
for optional settings [1]. But we keep poking holes in that
guideline, so one more hole for strings is probably not bit deal ;).
And none of the properties being touched here look like users would
want to explicitly set an empty string.
[1]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0-rc3/style.md#optional-settings-should-have-pointer-go-types
|
@duglin Thanks! I think cgroupPath should be fine as empty could mean let runtime handle it. For cpuset cpus/mems, I see that when we create a new cgroup it is empty :/ @crosbymichael @hqhq WDYT we should do about that? |
While we're touching style.md (assuming that happens in this PR),
GitHub's shifted their comment naming around and the initial source
for preferring pointers for optional settings is [1] (where @mrunalp
argues for *string for Cpus ;). I'm personally a fan of *string for
those reasons, but I'm not a maintainer, and it's not really a big
deal either way.
[1]: #233 (comment)
|
I think those are fine to keep as a non pointer because empty values on the cpus and mems is invalid |
Actually, an empty value for
And the docs have:
So we may want to retain the ability to explicitly write an empty string to |
@wking its incorrect |
The kernel allows it (and for |
@wking your example only works because you don't have any processes in the cgroup |
Ah, that makes sense then. We're more restricted than the kernel (not allowing empty strings for 868e631 is still missing JSON Schema and |
You know, it gets really old having to argue with you about everything, all the time. Can ya stop plz? I'm getting really frustrated. |
Dropping the ability to set an empty-string value seems like something that should be backed up with at least a line or two of motivation for why you don't need that ability. I'm fairly sure someone else besides me will wonder why we don't support the empty-string cpus/mems values that the kernel allows in general, and now we can point them to your comment to clear them up. I've filed the remaining changes I'd like to see against this branch in mrunalp#1 in case that helps. |
LGTM @wking You can file schema changes as a followup PR, thanks. |
Catch up with 868e631 (Remove string pointers, 2017-01-12, opencontainers#653). Signed-off-by: W. Trevor King <wking@tremily.us>
Catch up with 868e631 (Remove string pointers, 2017-01-12, opencontainers#653). Signed-off-by: W. Trevor King <wking@tremily.us>
If the timeout value was zero, the hook would always error, and there doesn't seem to be much point to that. And I'm not sure what negative timeouts would mean. By adding this restriction, we do not limit useful hook entries, and we give the validation code grounds to warn users attempting to validate configs which are poorly defined or have useless hook entries. I'd like to remove the pointer from the Go type to comply with our anti-pointer zero-value style (style.md) now that Go's zero-value is clearly invalid. However, there has been maintainer resistance to removing the pointer [1] (although I don't think this is consistent with previous maintainer statements that we don't need pointers when the zero value is invalid [2]). In order to land the normative spec change, this commit keeps the current *int for Hook.Timeout and punts a consistent policy to future work. [1]: opencontainers#764 (comment) [2]: opencontainers#653 (comment) Signed-off-by: W. Trevor King <wking@tremily.us>
An empty string works as null value for strings so we don't need string pointers.
Signed-off-by: Mrunal Patel mrunalp@gmail.com