Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
cmd,interfaces/mount: run snap-update-ns and snap-discard-ns from core if possible #3326
Conversation
zyga
added some commits
May 16, 2017
zyga
added some commits
May 16, 2017
|
@chipaca yes, I want to fix the immediate issue but I'm already writing some tests for that (we had none before) |
zyga
added some commits
May 16, 2017
| +// | ||
| +// Ensure we do not use older version of snapd, look for info file and ignore | ||
| +// version of core that do not yet have it. | ||
| +func coreSupportsReExec(corePath string) bool { |
mvo5
May 16, 2017
Collaborator
I would prefer a different name for this helper, most cores "support" re-exec, this code is about if the version of snapd in core is higher than the version currently running. Maybe newerSnapdIn("/path/to/core") ?
| + corePath := newCore | ||
| + coreTool := filepath.Join(newCore, "/usr/lib/snapd", tool) | ||
| + if !osutil.FileExists(coreTool) { | ||
| + corePath = oldCore |
mvo5
May 16, 2017
Collaborator
Not sure we still need to support oldCore at this point. This code will only be build in the core snap. We have frozen ubuntu-core at version 2.25.
zyga
May 16, 2017
Contributor
I wanted to keep it as is but I can remove it. If you agree I'll do it in a separate PR (I've started working on tests already)
| @@ -38,7 +39,7 @@ func mountNsPath(snapName string) string { | ||
| func runNamespaceTool(toolName, snapName string) ([]byte, error) { | ||
| mntFile := mountNsPath(snapName) | ||
| if osutil.FileExists(mntFile) { | ||
| - toolPath := filepath.Join(dirs.DistroLibExecDir, toolName) | ||
| + toolPath := cmd.InternalToolPath(toolName) |
mvo5
May 16, 2017
Collaborator
Feels like a slightly odd place cmd.InternalToolPath but then it also fits - it is about commands afterall.
zyga
May 16, 2017
Contributor
Yes, I was wondering where this all ought to live. Ideas welcome, I'll happily move this elsewhere
zyga commentedMay 16, 2017
This patch fixes "re-exec" of the two aforementioned tools by adding a new helper
cmd.InternalToolPathand using it in the right spot. I will follow up with a change to use the samehelper for
snap-confine