Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Difficult to edit certain parts of the filesystem #59

Open
mwleeds opened this issue Jul 2, 2019 · 1 comment
Open

Difficult to edit certain parts of the filesystem #59

mwleeds opened this issue Jul 2, 2019 · 1 comment

Comments

@mwleeds
Copy link

mwleeds commented Jul 2, 2019

Since the /usr in the flatpak sandbox is different from the host /usr, it's difficult to edit files there with flatpak'd vim: org.vim.Vim /usr/etc/dracut.conf.d/endless.conf results in vim opening a new empty file in a new directory rather than editing the file at that location on the host. Since nano is not installed via flatpak, nano /usr/etc/dracut.conf.d/endless.conf works fine.

A workaround is to use org.vim.Vim /run/host/usr/etc/dracut.conf.d/endless.conf but it would be nice to have a seamless solution to this.

@wjt
Copy link
Member

wjt commented Jul 2, 2019

Yeah. If you have ideas for what a seamless solution would be, I'm all ears. I do have some alternative seams you might like to try!

I have EDITOR=org.vim.Vim, which means sudoedit /usr/etc/dracut.conf.d/endless.conf does the right thing, because sudoedit copies the file to a temporary file in /var/tmp, which is visible in the sandbox for this reason. https://github.com/flathub/org.vim.Vim/blob/master/org.vim.Vim.json#L18

flatpak run has a --file-forwarding argument. Try flatpak run --file-forwarding org.vim.Vim @@ /usr/etc/dracut.conf.d/endless.conf. The .desktop files are rewritten to use this syntax so if you browse to /usr/etc/dracut.conf.d/ in Nautilus and open the file in (G)Vim then it can open the file. If the path in question is visible at that path inside the sandbox, it's passed through verbatim; otherwise it's mapped through the document portal. I think this could be made smarter in Flatpak itself: files in /usr could be mapped to /run/host/usr if the latter is visible.

I previously opened flatpak/flatpak#1947 about something similar and the conclusion was that it's not really possible to make the bare org.vim.Vim wrapper script smarter (without requiring that the user type @@ themself) because Flatpak can't otherwise distinguish between filename arguments and options. I've grown used to typing it out longhand but also at one point had a wrapper script, vim-ff, which was effectively an alias for flatpak run --file-forwarding org.vim.Vim @@ "$@".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants