-
Notifications
You must be signed in to change notification settings - Fork 596
JSON objects are easier to parse/manipulate #120
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
Conversation
|
understandable, but not the format for mount. This |
|
@vbatts You write "but leaving it as the string to be provided removes a moving-part of processing where other issues could be introduced." That "moving part" is a simple string concatination. That string computation is a one liner in most programming languages. If you use a string and for some reason that string had to be modified (to add, remove, or change on option) then the moving part would become something complex. Furthermore, I argue that this object WILL need to be modified at run time. In the examples, we see |
|
Fair. I just prefer fewer moving parts. Then the formating should likely be standardized. https://github.com/opencontainers/specs/pull/120/files#diff-695bac0ce528e5c6765a6666fcccc425R30 has mixed type values. These integers might should stay as strings, so there is not a type handling assumption for any given json library, and then string concat and join. |
|
IIRC, we did have a similar discussion on runc/libcontainer and had voted to keep it as it is. |
|
@mrunalp but you were wrong ;) . Joking aside, I think that your comment shouldn't have much weight in this current discussion. What arguments were raised against using an object? Lets try to make decisions based on the techincal merit of arguments and not past concensus. @vbatts I have changed gid to use a string. Along the same lines as only using strings as values, I was thinking that it might make sense to use |
runtime-config.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here. this is a bool, but if rw expects a string value of true, then this might as well be "true"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't expect to be true, it expects to be rw. The pattern is, if there is a string on the right hand side(RHS) then the syntax is item=string and if it is true then the syntax is item without an equals sign. That's why I suggested using nil rather than true.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh hurr. you're right. i wasn't even reading that as just rw. Would these be better as an array of strings then?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well I thought about that too, that would make:
["nosuid","noexec","newinstance","ptmxmode=0666","mode=0620","gid=5"]
And the code to change the gid searches through that list for a string that starts with "gid=" and replaces that string. Not too bad, but still a form of parsing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fair, but I think this is more acceptable though as the mount -o ... is required as a comma delimited list. So this would put the formating as the greatest common denominator.
81d03fd to
9b94c55
Compare
|
@vbatts I've updated the PR. |
|
nice nice. Also, I presume there could be similar for windows, but i'm unfamiliar there. |
|
i think this looks good. the array version is much better than object version. Also documentation for |
Don't use strings when you can use dictionaries/objects. JSON objects are trivial to parse and manipulate, unlike strings. String parsing is the opencontainers#1 cause of security bugs, so if it can be trivially avoided, then why not ;)
|
@dqminh oops, thanks. |
|
This is fine with me. The primary two folks wanting a flat options string were @crosbymichael and @LK4D4 IIRC. |
|
If we are going to change this, then might as well make it so there is no parsing required if possible. |
|
@mrunalp that was the point in making it not a dictionary. |
|
@vbatts Yes, but creating this new array still allows for items in the list to be key=value and that requires parsing the item to make sure it is correct which is only slightly better than what it is today. A dictionary could be converted into mount options in a single loop and there is no parsing necessary. |
|
the discussed |
|
@vbatts Yep, that's what I was referring to as well. |
|
That seems like sloppy semantics though. How is |
|
And a technical side note, a few |
|
@vbatts I am convinced but don't see what this PR buys then. However, I will stay out and go with whatever is decided :) |
|
Haha. That circles back to my first concern. I could still be on the fence,
|
|
change fine for me, looks exactly the same now just more |
|
I am agnostic here, but thought I'd link to #31, since that was the
last push to change the mount format (although it was pushing for a
less-structured model, and this PR aims for more structure).
In any case (and maybe in this PR since it touches those lines), I
think we should remove the no-options entries entirely (old
‘"options": ""’ and new ‘"options": []’). The field is optional, so
why bother giving an empty value?
|
|
using the list LGTM |
|
LGTM too |
|
LGTM |
JSON objects are easier to parse/manipulate
These snuck in with 7232e4b (specs: introduce the concept of a runtime.json, 2015-07-30, opencontainers#88) and 73bf1ba (JSON objects are easier to parse/manipulate, 2015-08-27, opencontainers#120). Signed-off-by: W. Trevor King <[email protected]>
Don't use strings when you can use dictionaries/objects. JSON objects are trivial to parse and manipulate, unlike strings. String parsing is the #1 cause of security bugs, so if it can be trivially avoided, then why not ;)