Snap applications cannot access the user's normal XDG directories

Bug #1577471 reported by Christopher Townsend
26
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Canonical System Image
Invalid
High
Pat McGowan
Snappy
Expired
Undecided
Unassigned

Bug Description

I have built a snap and have the home interface included and connected, but the application in the snap cannot see any of the normal XDG directories such as Documents, Music, Videos, Pictures, etc.

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

You will have access to those directories but you will not know where they are. I suspect that if the home interface is connected, before better things are in place, we could set all the XDG_$foo_DIR from the ubuntu-core-launcher (which can also read .config/user-dirs.dirs) and expose those variables to the started process.

This needs security input.

Changed in snappy:
status: New → Confirmed
tags: added: snapd-interface
Bill Filler (bfiller)
tags: added: snap-desktop-issue
Bill Filler (bfiller)
no longer affects: snappy (Ubuntu)
Revision history for this message
Bill Filler (bfiller) wrote :

@jdstrand
can you comment on this please? we're trying to understand our shared content store on Ubuntu Personal wrt Music, Pictures and Videos and whether apps will have access to ~/Music, ~/Pictures etc. This affects apps and services like mediascanner and thumbnailer and how they will operate.

Changed in snapd (Ubuntu):
assignee: nobody → Jamie Strandboge (jdstrand)
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

The root of this bug is that snaps have home set to HOME=/home/user/snap/$SNAP_NAME/$REVISION and that Music, Pictures, Videos, etc do not exist in /home/user/snap/$SNAP_NAME/$REVISION. Applications using the home interface can use getpwent() to discover the home directory of the user.

@Bill, as for your larger question, we discussed this a bit at the Hague. Please understand that the home interface is a transitional interface for applications that don't yet understand content-hub, out of process content selectors, etc. Ubuntu Touch was designed with content-hub/etc and application data silos and unless the direction has changed, we should not rely on the current home interface for Ubuntu Personal.

Interface slot implementations (aka, the Touch trusted helpers) like media-hub, thumbnailer, content-hub, etc, etc can continue to have the access they require. For now, they can use the home interface (with getpwent()). In this manner, the slot implementations use the home interface and the plugging applications do not (they instead continue to use whatever APIs the trusted helpers offer). This preserves the application data model, trusted helper design and should unblock you.

At the sprint people wanted to further restrict the home interface for certain applications (eg, just ~/Music and ~/Videos rather than all of home for media-hub , etc). How we do that needs a little bit of design, but I think I would prefer to not introduce more transitional interfaces for shared directories and instead augment the home interface with an attribute to declare the subset of home required. Perhaps this would be in another interface (eg, xdg-user-dirs). This work is not required to unblock you and can be discussed with the snappy team outside of this bug.

Changed in snapd (Ubuntu):
assignee: Jamie Strandboge (jdstrand) → nobody
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

Based on Zygmunt and my comments regarding getpwent(), this bug is a bit misnamed and as described this bug could be marked Invalid.

@Christopher - can you confirm that getpwent() works for you?

@Zygmunt and @Gustavo, should we export USER_HOME (or similar) that has the user's home directory from getpwent() to make this easier for people?

Changed in snappy:
status: Confirmed → Incomplete
Revision history for this message
Jamie Strandboge (jdstrand) wrote :

"we should not rely on the current home interface for Ubuntu Personal"

This should have said "we should not rely on the current home interface for consuming snaps that plugs unity8 on Ubuntu Personal".

Changed in canonical-devices-system-image:
assignee: nobody → Pat McGowan (pat-mcgowan)
importance: Undecided → High
milestone: none → p2
status: New → Confirmed
tags: added: personal
no longer affects: snapd (Ubuntu)
Changed in canonical-devices-system-image:
status: Confirmed → Invalid
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Snappy because there has been no activity for 60 days.]

Changed in snappy:
status: Incomplete → Expired
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.