Classic confinement should allow preservation of $HOME

Bug #1688103 reported by Mike Pontillo
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Invalid
Undecided
Unassigned
snapd
Fix Released
Undecided
Unassigned

Bug Description

I'm trying to snap something that assumes that $HOME will be unchanged when it executes. For example, in order to use the app, you are required to do something like:

    mkdir $HOME/.my-snap
    my-snap --baz $HOME/.my-snap
    my-snap <args>

I'm trying to use classic confinement to do so. (I also tried using the 'home' interface, but that didn't seem to have any effect.)

When you run `my-snap` it assumes that the user has already properly set up $HOME/.my-snap. You are required to set up $HOME/my-snap by running one of the utility apps that ships with the snap.

So I need a way to preserve $HOME so that it points to my original $HOME, not $HOME/snap/[...].

$ snap version
snap 2.24
snapd 2.24
series 16
ubuntu 16.04
kernel 4.4.0-75-generic

Revision history for this message
Mike Pontillo (mpontillo) wrote :

Not sure I filed this in the correct place; adding Snappy. Though I suppose I'll leave the bug in both in case a fix is needed in both places.

Revision history for this message
Mike Pontillo (mpontillo) wrote :

My problem was that I was incorrectly specifying the 'home' plug. When I changed the Snapcraft YAML as follows, everything worked as expected:

apps:
  foo:
    plugs:
     - home
    command: bin/foo
    ...

Changed in snapcraft:
status: New → Invalid
Changed in snappy:
status: New → Invalid
Revision history for this message
Mike Pontillo (mpontillo) wrote :

Hm, I'm still seeing intermittent behavior here.

$ snap run --shell foo
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.

$ echo $HOME
/home/user/snap/foo/x1

$ exit
$ snap interfaces | grep home
:home foo

This is with it snapped in devmode. For some reason, it seemed to work when I tried it earlier; I don't know what changed.

description: updated
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

I just tested this with snapd 2.27.2 and HOME is not altered for snaps that use classic confinement. I'm marking this as FIX-RELEASED.

no longer affects: snappy
Changed in snapd:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.