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

cmd: rework reexec detection #3608

Merged
merged 5 commits into from Jul 20, 2017
Merged

Conversation

mvo5
Copy link
Contributor

@mvo5 mvo5 commented Jul 20, 2017

This reworked the detection if we already re-execed or not. The logic is simply to check if the /proc/self/exe points inside the /snap/* directory. If that is the case we did already re-exec and there is no need to do anything further.

This also contains the bugfix when re-execing from snapd 2.21 which used to set SNAP_REEXEC=0.

mvo5 added 2 commits July 20, 2017 10:17
We need to special case the env handling for snapd re-execing
from 2.21. In this version of snap/snapd we did set SNAP_REEXEC=0
when we re-execed.

In this case we need to unset the reExecKey to ensure that subsequent
run of snap/snapd (e.g. when using classic confinement) will *not*
prevented from re-execing.
Check /proc/self/exe directly to determine if we already re-execed
instead of relying on a environement key.
Copy link
Collaborator

@zyga zyga left a comment

Choose a reason for hiding this comment

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

This looks OK; if the tests pass then let's merge it

This test validates that a snap using classic confinement can call into
the snap itself. We discovered several bugs related to this behavior
so the test will help to ensure this does not regress anymore.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
@codecov-io
Copy link

codecov-io commented Jul 20, 2017

Codecov Report

Merging #3608 into master will decrease coverage by 0.02%.
The diff coverage is 47.05%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3608      +/-   ##
==========================================
- Coverage    74.9%   74.88%   -0.03%     
==========================================
  Files         380      380              
  Lines       32952    32961       +9     
==========================================
  Hits        24682    24682              
- Misses       6477     6485       +8     
- Partials     1793     1794       +1
Impacted Files Coverage Δ
cmd/cmd.go 83.87% <47.05%> (-8.99%) ⬇️
overlord/ifacestate/helpers.go 62.33% <0%> (ø) ⬆️
interfaces/sorting.go 91.42% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a462005...8401774. Read the comment docs.

@zyga zyga merged commit fa7cae5 into snapcore:master Jul 20, 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
4 participants