Application cwd in SNAP_APP_PATH vs SNAP_APP_DATA_PATH

Jamie Strandboge jamie at canonical.com
Fri Mar 18 12:40:32 UTC 2016


On Fri, 2016-03-18 at 05:31 -0300, Sergio Schvezov wrote:
> 
> El 18/03/16 a las 04:56, Didier Roche escribió:
> > 
> > Le 17/03/2016 23:17, Kyle Fazzari a écrit :
> > > 
> > > 
> > > On 03/17/2016 06:06 PM, Sergio Schvezov wrote:
> > > > 
> > > > 
> > > > El 04/03/16 a las 13:03, Gustavo Niemeyer escribió:
> > > > > 
> > > > > On Fri, Mar 4, 2016 at 1:01 PM, Didier Roche <didrocks at ubuntu.com
> > > > > <mailto:didrocks at ubuntu.com>> wrote:
> > > > > 
> > > > >     So, they will probably either use:
> > > > >     $SNAP/<path_to_asset_or_helper>
> > > > > 
> > > > > 
> > > > > To be fair, that argument goes both ways. They might just as well do
> > > > > $SNAP_DATA/<path to data>.
> > > > I am very late to this thread, but it seems all apps default to
> > > > SNAP_DATA?
> > > > 
> > > >     ubuntu at localhost:~$ hello-world.env | grep '^PWD='
> > > >     PWD=/var/lib/snaps/hello-world.canonical/6.0
> > > > 
> > > > Why not SNAP_USER_DATA? As a user I cannot do anything on SNAP_DATA
> > > > unless I sudo, if that were the case I'd prefer the current PWD to be
> > > > preserved so at least I know where I am.
> > > +1 for PWD for binaries, SNAP_DATA for services.
> > I don't think we should have a different data access experience (PWD vs
> > SNAP_DATA) between services and binaries. This brings some inconsistency
> > and creates confusion IMHO.
> > 
> > However, I kind of agree now that this is implemented to rather get
> > SNAP_USER_DATA for commands (as the commands are running as an user) and
> > SNAP_DATA for services (which are running as root), unless we let them
> > running as an user.
> > 
> > Does this make sense to everyone?
> I'd use PWD for everything to avoid confusions.
> 
> Coincidentally though, the systemd units would make use of
> `WorkingDirectory=` to set it to SNAP_DATA for root run services and
> SNAP_USER_DATA for user ones (when those come).
> 
> The binaries one is quite tricky because I'll try to access a file and
> all of the sudden I'll get "No such File or directory" style errors.
> 
> 
>     $ cd ~
>     # in theory this would be just `vim` in the future.
>     $ vim.editor Documents/myfile
> 
> 
> I still prefer SNAP_USER_DATA though.
> 
IMO, SNAP_USER_DATA is fine so long as it is set correctly for the user, ie in
/root/snaps/... for root and /home/.../snaps/... for non-root. Otherwise we
continue to have issues with root owned files and directories in
/home/.../snaps/... that the user has to somehow correct with sudo, etc.

-- 
Jamie Strandboge             | http://www.canonical.com

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <https://lists.ubuntu.com/archives/snappy-devel/attachments/20160318/25fd94e3/attachment.pgp>


More information about the snappy-devel mailing list