Skip to content
This repository has been archived by the owner on Aug 14, 2020. It is now read-only.

actool: allow patch-manifest to override caps isolators #638

Merged
merged 1 commit into from
Jul 11, 2016

Conversation

lucab
Copy link
Contributor

@lucab lucab commented Jul 8, 2016

This commit unifies patch-manifest behavior so that --capability
and --revoke-capability are able to override existing isolators.
It will also remove one possible way of generating invalid
manifests with multiple conflicting capabilitiess isolators.

@lucab
Copy link
Contributor Author

lucab commented Jul 8, 2016

/cc @alban as per private discussion

This is the same behavior that patch-manifest has for patching seccomp isolators.

return err
}
app.Isolators = append(app.Isolators, *isolator)
// Override existing capabilities isolators
Copy link
Contributor

Choose a reason for hiding this comment

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

Comment doesn't belong here

@lucab lucab force-pushed the to-upstream/actool-patch-caps branch from 16d4dfc to 7b258ea Compare July 8, 2016 17:06
@lucab
Copy link
Contributor Author

lucab commented Jul 8, 2016

Rebased

@alban
Copy link
Member

alban commented Jul 11, 2016

@lucab it looks good. As a smoke test, did you run the rkt tests (TestCaps*) with that patch?

@lucab
Copy link
Contributor Author

lucab commented Jul 11, 2016

@alban not yet, but I can give it a run right now.

@lucab
Copy link
Contributor Author

lucab commented Jul 11, 2016

@alban tested locally, no regressions spotted.

if err != nil {
return fmt.Errorf("cannot parse capability retain set %q: %v", patchCaps, err)
}
capsIsolator, err = caps.AsIsolator()
Copy link
Contributor

Choose a reason for hiding this comment

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

This is not doing what you want. On line 217 you're shadowing the error on line 214. So it's never going to get correctly assigned here.

Copy link
Contributor

@jonboulle jonboulle Jul 11, 2016

Choose a reason for hiding this comment

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

Change 213 to

var capsAsIsolator types.AsIsolator

Then line 217 and 225 can change to just assignments, and you can call AsIsolator() outside of the branches.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are painfully right on that, I didn't notice the variable shadowing going on. Fixed as suggested.

This commit unifies patch-manifest behavior so that --capability
and --revoke-capability are able to override existing isolators.
It will also remove one possible way of generating invalid
manifests with multiple conflicting capabilitiess isolators.
@lucab lucab force-pushed the to-upstream/actool-patch-caps branch from 7b258ea to b9f7648 Compare July 11, 2016 10:19
@jonboulle
Copy link
Contributor

LGTM

@jonboulle jonboulle merged commit 7502e45 into appc:master Jul 11, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants