flatpak icon indicating copy to clipboard operation
flatpak copied to clipboard

:create suffix only creates dirs

Open bam80 opened this issue 7 years ago • 13 comments

For --filesystem=FS option, ":create suffix indicates that the location will be read-write and created if it doesn't exist".

If it doesn't exist, it will always be treated as directory, and created as such. There is no way to point that last part of the created location should be a file.

bam80 avatar Nov 11 '18 18:11 bam80

Does it really make sense to create a file without giving it any content?

matthiasclasen avatar Nov 12 '18 12:11 matthiasclasen

@matthiasclasen I think yes, because otherwise you can't bind mount a file if it doesn't exist

bam80 avatar Nov 12 '18 12:11 bam80

This is required to for https://flathub.org/apps/details/com.hamrick.VueScan . The application creates a file ~/.vuescanrc during runtime.

The author has currently no roadmap to move this file (~/.vuescanrc ) with registration information to ~/.vuescan/vuescanrc .

From https://github.com/flathub/com.hamrick.VueScan/blob/master/com.hamrick.VueScan.yaml

$ vi com.hamrick.VueScan.yaml
...
finish-args:
# The aurhor has no roadmap to move the rc file to ~/.vuescan/vuescanrc 
# An empty file needs to be created before the first run with the command below
#     $ touch ~/.vuescanrc
  - --filesystem=~/.vuescanrc # License file
  - --persist=.vuescan

ritzk avatar Jan 01 '19 16:01 ritzk

I would suggest to patch the app. It should not look at either ~/.vuescanrc or ~/.vuescan/vuescanrc but at $XDG_CONFIG_HOME/vuescanrc

matthiasclasen avatar Jan 01 '19 16:01 matthiasclasen

Most of the bad behaving apps are proprietary.

TingPing avatar Jan 01 '19 17:01 TingPing

Regarding vuescan this is probably fine: https://github.com/flathub/com.hamrick.VueScan/pull/1

TingPing avatar Jan 01 '19 17:01 TingPing

@TingPing This does not help, if the file ( ~/.vuescanrc) does not exist.

Either

  • flatpak will need to create an empty file ( recommended)
  • or, Alternatively, one can pass "--env=HOME=~/.vuescan/" to workaround this issue ( comes with other sets of issues)

@matthiasclasen proprietary application. The author has no plans to update this behaviour.

ritzk avatar Jan 02 '19 13:01 ritzk

Yes, I had to revert https://github.com/flathub/com.hamrick.VueScan/pull/1 since it created an empty directory named .vuescanrc when actually, an empty file is needed instead.

The current manifest doesn't actually work as intended either, because the user needs to create the empty file manually at ~/.vuescanrc since :create and such always assumes folders are to be created.

FakeShemp avatar Jan 13 '19 16:01 FakeShemp

Next question here is how to do this compatibly.

We may have to add a new :create-file suffix, since existing users wille expect that :create always creates a directory

Should this be --filesystem=~/vuescanrc:create-file or --persist=.vuescanrc:create-file ?

matthiasclasen avatar Jan 13 '19 19:01 matthiasclasen

If persist could create a file, that would be preferable.

FakeShemp avatar Jan 13 '19 19:01 FakeShemp

If persist could create a file, that would be preferable.

You are going backwards, --persist is to avoid escaping the sandbox and --filesystem is to escape the sandbox. The former should never need to create anything because the only reason :create exists is the technical detail of how bind mounts work pulling in data from outside the sandbox.

TingPing avatar Jan 13 '19 20:01 TingPing

well, --persist bind mounts too, no ?

matthiasclasen avatar Jan 13 '19 22:01 matthiasclasen

Hmm, I suppose it does, but clearly the filename doesn't have to exist ahead of time or else it would be useless. Would have to look into how that works.

TingPing avatar Jan 14 '19 18:01 TingPing