The remapped $HOME directory shows as read-only to applications running in a snap
Bug #1577472 reported by
Christopher Townsend
This bug affects 3 people
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
snapd |
Expired
|
Undecided
|
Unassigned |
Bug Description
I have created a snap with the home interface included and connected. $HOME is remapped to a different location during snap install. When an application tries to write to the new location, it says it is read-only and fails.
Changed in snappy: | |
status: | Expired → New |
status: | New → Confirmed |
To post a comment you must log in.
I just made a test snap that has the home interface and I cannot reproduce this bug.
snapcraft.yaml:
name: ifaces-demo-home demo-home:
stage- packages: [busybox-static]
version: 0.1
summary: Example snap using the home interface
description: |
This is an example snap for teaching developers about app confinement and
interfaces. In particular, this snap focuses on the "home" interface that
grants access to most of the users' home directory
apps:
ifaces-
command: busybox
plugs:
home:
parts:
shell:
plugin: nil
Build, install and connect the snap:
$ snapcraft demo-home_ 0.1_amd64. snap demo-home: home ubuntu-core:home
$ sudo snap install --devmode ./ifaces-
$ sudo snap connect ifaces-
Then you should be able to run a shell with:
$ ifaces-demo-home sh
Inside the shell you can inspect the environment. As you should be able to see the $HOME variable is altered:
~/Dokumenty/ Snaps/home- demo $ echo $HOME snap/ifaces- demo-home/ 100001
/home/zyga/
I think it is an interesting bug, if HOME should be altered in this case. I think it should but we should also expose OLD_HOME or something like that (maybe SNAP_USER_HOME).
Quick experiments (mkdir, cat, etc) will show you that the process indeed has access to most of the files in the home directory. Dot files are not allowed. I would perhaps argue that we should allow reading .config/ user-dirs. dirs OR perhaps read it from ubuntu- core-launcher and set the relevant XDG variables directly.