Flatpak: Allow --persist to be used to separate files/directories of the container from the host

Created on 26 Dec 2018  路  4Comments  路  Source: flatpak/flatpak

Linux distribution and version

Fedora 29

Flatpak version

1.0.6

Description of the problem

Some applications store their state outside of ~/.config and ~/.local and hence Flatpak does not automatically pick it up. If the application also needs access to the host file system, there currently appears to be no way to separate the configuration of the application in the container from the other versions of the application installed on the host. This can lead to problems, if the configuration is environment specific.

The application in this case is IntelliJ IDEA. It has access to the whole host file system, thus flatpak run --persist=.IntelliJIdea2018.3 does not have any effect (as explained in the documentation of flatpak run: "If the application doesn't have access to the real homedir, ..."). This leads to problems with configured paths to Git, Mercurial, JDKs and possibly more, since these paths depend on the environment and hence the configuration cannot be shared between the host and the container. (flathub/com.jetbrains.IntelliJ-IDEA-Ultimate#9) I currently do not see any way to separate the configuration of the application inside the container from other versions of the application on the host.

It would thus be useful if --persist could be used independently of $HOME being mounted into the container, since then it could serve the purpose of overriding directories that might be used differently on the host with a Flatpak specific version, as in the case of environment dependent configuration.

sandbox

Most helpful comment

I'm trying to package a proprietary client app for some online storage website, which creates a (non-hidden) directory under $HOME for its correct functionality, so I would like to see this feature implemented to avoid polluting the user's home directory. I don't think flatpak should be accounted for bad behaviors of random applications but such programs might never get fixed.

All 4 comments

Some applications store their state outside of ~/.config and ~/.local and hence Flatpak does not automatically pick it up.

It is opinionated but this is kinda just an application bug. The XDG spec is very old and widely implemented at this point. Applications that don't respect it are usually just ports that didn't even know it existed or unmaintained software.

I concur; the best fix here would be for apps to gain xdg-dirs support.

I'm trying to package a proprietary client app for some online storage website, which creates a (non-hidden) directory under $HOME for its correct functionality, so I would like to see this feature implemented to avoid polluting the user's home directory. I don't think flatpak should be accounted for bad behaviors of random applications but such programs might never get fixed.

There is another case why I think this is important.

Flatpak applications may also create directories like:
.mono, .swt, .java, .pki or .zynaddsubfx-bank-cache.xml (file) are these covered by the xdg-dirs?

From the 1000 applications over a 100 create directories/files in the users home.
I don't think they will ever be fixed.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

glaubersm picture glaubersm  路  3Comments

mairin picture mairin  路  5Comments

TingPing picture TingPing  路  4Comments

LaurentBonnaud picture LaurentBonnaud  路  6Comments

bastianilso picture bastianilso  路  3Comments