Skip to content

Conversation

@Mashimiao
Copy link

It's valid for values to start with '=' .

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

pair := strings.Split(s, "=")
if len(pair) != 2 {
pair := strings.SplitN(s, "=", 2)
if len(pair) != 2 || pair[0] == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Changing from SplitSplitN makes sense (allowing = to occur in the value). But I'm not clear on this empty-string comparison here. My understanding is that the spec allows empty-string keys for annotations, and that matches your f2c88e2 commit message. But this line will lead to “incorrectly specified…” errors when the argument starts with an equals sign. The SplitSplitN change may be all we need.

@Mashimiao
Copy link
Author

Mashimiao commented Dec 28, 2016 via email

@wking
Copy link
Contributor

wking commented Dec 28, 2016 via email

@Mashimiao Mashimiao force-pushed the generate-fix-parse-label branch from f2c88e2 to a809a4d Compare December 28, 2016 08:35
@Mashimiao
Copy link
Author

I try to use ':=' as separator. I think it's specially designed, then keys/values can contain '=' or backslash escapes or some others.

@wking
Copy link
Contributor

wking commented Jan 3, 2017 via email

@Mashimiao Mashimiao force-pushed the generate-fix-parse-label branch from a809a4d to fa036ec Compare January 4, 2017 06:03
@Mashimiao
Copy link
Author

I'm not sure how you test foo\=bar=baz. But I don't think it can work, because \= also contains an equals sign.
If you really think all kinds of specific defined strings could be part of key and restrict the possible key strings, I don't have a good solution to solve this.
In this PR, I will just make values contain equals sign supported, and clearly tell users keys contain equals sign are not supported.
@wking If you have any other good solutions to fix it, you can submit a separate PR. I look forward to it

@wking
Copy link
Contributor

wking commented Jan 4, 2017 via email

@Mashimiao Mashimiao force-pushed the generate-fix-parse-label branch from fa036ec to 75be481 Compare January 13, 2017 02:18
@Mashimiao
Copy link
Author

According to runtime-spec/#645, updated PR to add empty-string key comparison.

@wking
Copy link
Contributor

wking commented Jan 13, 2017

With the spec change, 75be481 looks good to me.


**--label**=[]
Add annotations to the configuration e.g. key=value.
Currently, key contains equals sign is not supported.
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: contains -> containing

Copy link
Author

Choose a reason for hiding this comment

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

fixed, thanks

@Mashimiao Mashimiao force-pushed the generate-fix-parse-label branch from 75be481 to 61b1b7d Compare January 17, 2017 01:04
It's valid for values to contain '='.

Signed-off-by: Ma Shimiao <[email protected]>
@Mashimiao
Copy link
Author

@mrunalp @liangchenye @hqhq PTAL

@hqhq
Copy link
Contributor

hqhq commented Jan 17, 2017

LGTM

Approved with PullApprove

1 similar comment
@liangchenye
Copy link
Member

liangchenye commented Jan 17, 2017

LGTM

Approved with PullApprove

@Mashimiao Mashimiao merged commit 1a4a299 into opencontainers:master Jan 17, 2017
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.

5 participants