snapenv: add environment variable with UID value#12565
snapenv: add environment variable with UID value#12565mvo5 merged 11 commits intocanonical:masterfrom
Conversation
169f491 to
69b62fe
Compare
|
This needs to define a matching assume (snap-uid perhaps)?, see o/snapstate/check_snap.go, as a snap using this, especially directly from the snap.yaml running on a old snapd would usually fail without ways to fallback so we need to way to prevent it installing early |
8516bfd to
a8e4767
Compare
|
@pedronis Good point! Added. |
pedronis
left a comment
There was a problem hiding this comment.
this looks alright in itself, I asked though security to review to see if they can chime in about a proper comment on the usage of euid
|
About the "needs documentation" tag... where should I send a patch to include that? |
|
bb2d3a7 to
6cd271b
Compare
53c053c to
b816223
Compare
Some ENVs require the user ID, but the only way of getting it is using a little shell script that exports the ENV after using "id -u" to get the value. Other uses tricks, like taking advantage of a similar path (like firefox, which sets PULSE_SERVER to "$XDG_RUNTIME_DIR/../pulse/native". This patch adds the SNAP_UID environment variable, which contains the effective user id. With that, it's possible to define paths containing it directly in the YAML file.
9ae6c40 to
5df0079
Compare
|
Commented in the documentation thread the new variables. https://forum.snapcraft.io/t/environment-variables/7983/28?u=sergiocostas |
Some ENVs require the user ID, but the only way of getting it is using a little shell script that exports the ENV after using "id -u" to get the value. Other uses tricks, like taking advantage of a similar path (like firefox, which sets PULSE_SERVER to "$XDG_RUNTIME_DIR/../pulse/native".
This patch adds the SNAP_UID environment variable, which contains the effective user id. With that, it's possible to define paths containing it directly in the YAML file.