Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Change wrapper to use /root instead of $HOME if run as root. #264
Conversation
|
Can one of the admins verify this patch? |
|
Note that this PR implements portions of Jamie's Proposal _#_1 here:
This PR assumes that (1) and (3) are already done, and completes (2) and (4). |
|
FYI, '3' is done. '1' will be correctly done as a result of '2' being implemented. |
|
@jdstrand excellent! |
|
I agree with the approach taken of adjusting the wrapper to check if root using 'id -u' and if it is '0', using /root/apps instead. I have a nitpick: I prefer to use an equal on '0' rather than a not equals for clarity such that the resulting wrapper becomes: if [ "$(id -u)" = "0" ]; then I'll let others comment on the go code. Thanks for the pull request! :) |
|
Actually, the fix for apparmor policy is in xenial but not in edge: $ cat /usr/share/snappy/security-policy-version |
|
@jdstrand agreed on the clarity nitpick, I went back and forth on that-- fixed. Also, any chance we could get that apparmor fix (and this patch, if possible) back into trusty through wily (really wherever Snappy is released)? |
|
Ok, it was a local problem. 16.04 does have the apparmor fix. ubuntu-core-security 15.04.12~ppa14 also has the fix for 15.04 and it is confirmed in the latest 15.04 stable. |
|
This will leave data behind on purge; look for |
|
Is there a good reason for us to duplicate every occurrence of $HOME because it's the root user? Why aren't we building that logic based on the fact $HOME can point to /root, as commonly done elsewhere? |
|
When running under sudo, $HOME will be e.g. /home/ubuntu; additionally
|
Right, I understand that this is exactly the issue being addressed. The question is why aren't we fixing the fact HOME is pointing to something else than what we want instead? If the goal was to preserve the behavior of sudo, we would probably not pick proposal 1 from James proposal as I understand it. So, why are we not defining the user's home concept to be more consistent and easily understandable, instead of spreading conditionals through special cases? Reviewing this code and reading the above conversation, I feel like we'll see bugs being reported about more special cases we forgot about soon. |
|
ah. Yes, good point. Need to step back a little and see if it's doable; it On 5 January 2016 at 18:14, Gustavo Niemeyer notifications@github.com
|
niemeyer
referenced this pull request
Jan 6, 2016
Closed
Remap user-level environment to system-level for services. #269
|
I'm closing this so we can more easily wait for it (or another PR) to reflect the agreement in the mailing list. |
kyrofa commentedDec 17, 2015
Currently Snappy services (which are run as root) use
/root/apps/for$SNAP_APP_USER_DATA_PATH. However, Snappy binaries always use$HOME/apps/, which resolves to the real user's home even if run with sudo.This PR fixes this inconsistency by having Snappy binaries behave more like Snappy services, and making sure that
/root/apps/is handled the same way as/home/*/apps/when it comes to upgradesetc.
Fixes LP: #1466234