Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/oci-runtime-tool/generate.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,8 @@ func setupSpec(g *generate.Generator, context *cli.Context) error {
if context.IsSet("label") {
annotations := context.StringSlice("label")
for _, s := range annotations {
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.

return fmt.Errorf("incorrectly specified annotation: %s", s)
}
g.AddAnnotation(pair[0], pair[1])
Expand Down
1 change: 1 addition & 0 deletions man/oci-runtime-tool-generate.1.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ read the configuration from `config.json`.

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

**--linux-cpu-shares**=CPUSHARES
Specifies a relative share of CPU time available to the tasks in a cgroup.
Expand Down