Uh oh!
There was an error while loading. Please reload this page.
JSON objects are easier to parse/manipulate - #120
Conversation
vbatts
commented
Aug 27, 2015
understandable, but not the format for mount. This |
timthelion
commented
Aug 27, 2015
@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 |
vbatts
commented
Aug 27, 2015
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. |
mrunalp
commented
Aug 27, 2015
IIRC, we did have a similar discussion on runc/libcontainer and had voted to keep it as it is. |
timthelion
commented
Aug 27, 2015
@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 |
There was a problem hiding this comment.
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.
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.
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.
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.
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
9b94c55Comparetimthelion
commented
Aug 27, 2015
@vbatts I've updated the PR. |
vbatts
commented
Aug 27, 2015
nice nice. Also, I presume there could be similar for windows, but i'm unfamiliar there. |
dqminh
commented
Aug 27, 2015
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 ;)
timthelion
commented
Aug 27, 2015
@dqminh oops, thanks. |
philips
commented
Aug 27, 2015
This is fine with me. The primary two folks wanting a flat options string were @crosbymichael and @LK4D4 IIRC. |
mrunalp
commented
Aug 27, 2015
If we are going to change this, then might as well make it so there is no parsing required if possible. |
vbatts
commented
Aug 27, 2015
@mrunalp that was the point in making it not a dictionary. |
mrunalp
commented
Aug 27, 2015
@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. |
vbatts
commented
Aug 27, 2015
the discussed |
mrunalp
commented
Aug 27, 2015
@vbatts Yep, that's what I was referring to as well. |
vbatts
commented
Aug 27, 2015
That seems like sloppy semantics though. How is |
vbatts
commented
Aug 27, 2015
And a technical side note, a few |
mrunalp
commented
Aug 27, 2015
@vbatts I am convinced but don't see what this PR buys then. However, I will stay out and go with whatever is decided :) |
vbatts
commented
Aug 27, 2015
Haha. That circles back to my first concern. I could still be on the fence,
|
crosbymichael
commented
Aug 27, 2015
change fine for me, looks exactly the same now just more |
wking
commented
Aug 28, 2015
via email
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? |
crosbymichael
commented
Aug 28, 2015
using the list LGTM |
LK4D4
commented
Aug 28, 2015
LGTM too |
vbatts
commented
Aug 28, 2015
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 <wking@tremily.us>
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 ;)