flathub / org.kde.kate

https://flathub.org/apps/details/org.kde.kate
3 stars 5 forks source link

Needs --filesytem=/tmp #25

Closed Waqar144 closed 1 year ago

Waqar144 commented 1 year ago

Following up from https://github.com/flathub/org.kde.kate/pull/24

I don't really understand why we need to have /tmp shared? Is this for getting the output of applications that are run outside the Flatpak?

The reason is that Kate invokes processes on the host and then passes the temporary file as an argument.

E.g.,

The new formatter plugin (v23.04) will

Similarly, the project plugin stores the ctag index into a temporary file. This file is passed as an argument to the ctags process.

We use QTemporaryFile to create and manage temporary files.

@travier

travier commented 1 year ago

So as I mentioned in https://github.com/flathub/org.kde.kate/pull/24#issuecomment-1467779235, I think it would be really great if Kate could use something like xdg-run/kate instead of /tmp for temporary files.

Waqar144 commented 1 year ago

@travier I tried once more to make sure I wasn't getting anything wrong.

The thing is we want a path that is accessible by both the host and flatpak. If we use $XDG_RUNTIME_DIR/kate, host processes fail to access the temporary files we create. There might be a way to convert xdg-run/kate to a proper host path but I am not sure if that would be a reliable way and most likely that wouldn't be an acceptable solution as it requires us changing + ensuring all the scenarios work.

In contrast, /tmp just works. So I think this is the simplest solution that will work for now.

travier commented 1 year ago

Did you make sure to grant the Kate Flatpak access to xdg-run/kate when testing this? This path should be accessible both outside and inside the Flatpak.

Edit: I've just tried it and it needs to be created outside before the Flatpak startup to be accessible inside:

$ cd $XDG_RUNTIME_DIR
$ mkdir kate
$ touch kate/foo
$ flatpak run --filesystem=xdg-run/kate --command=bash org.kde.kcalc
$ ls $XDG_RUNTIME_DIR/kate
foo
travier commented 1 year ago

OK, so that makes it not a viable solution

travier commented 1 year ago

/tmp it is 😢

Waqar144 commented 1 year ago

I tried to create a directory when launching up by running mkdir, the directory does get created but it is not usable during that session. On the next session it works.