Skip to content
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

apicaps: record the correct caps when constructing a CapSet #541

Merged
merged 1 commit into from
Jul 25, 2018

Conversation

ijc
Copy link
Collaborator

@ijc ijc commented Jul 25, 2018

We need to capture c within the loop, otherwise all of the entries of m end
up pointing to the same thing, which is the last cap in range caps.

The symptom was that all caps were enabled/disabled based on the last cap's
setting and not their own.

Add a test for this.

Signed-off-by: Ian Campbell ijc@docker.com

Noticed when adding a cap for #533 that the test didn't fail when I disabled it...

We need to capture `c` within the loop, otherwise all of the entries of `m` end
up pointing to the same thing, which is the last cap in `range caps`.

The symptom was that all caps were enabled/disabled based on the last cap's
setting and not their own.

Add a test for this.

Signed-off-by: Ian Campbell <ijc@docker.com>
@tonistiigi tonistiigi merged commit 7676543 into moby:master Jul 25, 2018
@tonistiigi
Copy link
Member

@ijc Thanks!

@ijc
Copy link
Collaborator Author

ijc commented Jul 26, 2018

@tonistiigi it occurred to me this morning that since we are now copying each cap anyway perhaps m might just as well be a map[string]pb.APICap instead of a map[string]*pb.APICap, or that this function should take a []*pb.APICap in the first place.

(shame there's no range syntax which gives pointers to each element of a slice, I suppose &caps[i] could be used)

@ijc ijc deleted the fix-cap-checks branch July 26, 2018 09:00
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.

2 participants