-
-
Notifications
You must be signed in to change notification settings - Fork 394
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
flatpak-spawn cannot allocate TTy properly #3285
Comments
Yikes, not sure how I managed to do this, but I fixed the issue in vscode with these settings, and they allocate a tty: // settings.json
"terminal.integrated.shell.linux": "/usr/bin/flatpak-spawn",
"terminal.integrated.shellArgs.linux": ["--host", "toolbox", "run", "env", "TERM=xterm-256color", "fish"], |
I have this problem and I am not willing to install yet another dependency, in this case |
I use
That works beautifully if TERM is set correctly in the first place. |
You cannot use that @ibotty. If you configure vscode as this: "terminal.integrated.env.linux": {
"EDITOR": "code --wait",
},
"terminal.integrated.shell.linux": "flatpak-spawn",
"terminal.integrated.shellArgs.linux": ["--host", "toolbox", "run", "env", "TERM=$TERM", "EDITOR=$EDITOR", "bash"], Then inside the terminal: ⬢[yajo@toolbox ~]$ echo $TERM
$TERM
⬢[yajo@toolbox ~]$ echo $EDITOR
$EDITOR No luck... |
I have tried this and it opens a shell indeed: "terminal.integrated.shell.linux": "flatpak-spawn",
"terminal.integrated.shellArgs.linux": ["--host", "toolbox", "enter"], It should be the desired way, however the problem seems to be the missing env variables, even those defined in Possibly due to containers/toolbox#29. |
@yajo, it seems it does not work from within vscode (which totally makes sense). It does work perfectly from inside a shell. I have no idea what terminal vscode emulates. If bash works when called directly, vscode does set TERM for the calling process. If so, you might use something like |
And I am pretty sure it's unrelated to containers/toolbox#29. Because flatpak-spawn does not inherit TERM even without toolbox in sight. |
Yes, indeed the problem seems to be inside |
A rather ugly but usable workaround if you need something immediately could
be to run a private (not exposed to the public network) ssh server on your
host system, then drop a tiny, statically linked ssh client like dropbear
in some directory your Flatpak can access and use it to open a terminal on
the host. (I've been meaning to play with integrating this with VS Code's
ssh support automatically for some time but haven't really gotten a chance.)
…On Mon, May 11, 2020 at 11:33 AM Jairo Llopis ***@***.***> wrote:
Reopened #3285 <#3285>.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3285 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAM4YSKZPYAG7TOKZN2FZCTRRASE3ANCNFSM4JYHHJ7A>
.
--
Ryan (ライアン)
Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else
https://refi64.com/
|
I think this is a pretty good solution "terminal.integrated.shell.linux": "flatpak-spawn",
"terminal.integrated.shellArgs.linux": [ "--host", "--env=TERM=xterm-256color", "toolbox", "enter" ] Thinking that |
OOooooOoh that works! |
I'm using zsh as my shell and this worked for me on GoLand and WebStorm |
The problem with this approach is the loss of |
For the specific case of Visual Studio Code, another ugly but usable workaround is to modify local files via ssh to localhost. Which maybe is not that ugly and would let you sandbox the flatpak even more. |
Hey, thx, work as it should. I see that the vscode changed the way to integrate the shell, so use this config. Worked for me.
|
I wonder what Tilix is doing differently. It seems to have access from flatpak to the host shell without It has some issue now with the |
Tilix uses the same D-Bus APIs that flatpak-spawn uses, it just calls them directly.
The Tilix Flatpak has always had some memory corruption / double free issues, likely tied somehow to the D-Bus calls it makes. I tried looking into it a long time ago but couldn't resolve it, which is why it was never published to Flathub. |
FWIW, I have an alternative implementation of |
Workaround for the following flatpak bug: flatpak/flatpak#3285 Idea taken from here: contour-terminal/contour#794
Coming across this I figured I might want to mention what the underlying issue is, because I didn't see it mentioned here. Years ago when doing the initial version of GNOME Builder which flatpak's everything, I had to change how PTY's were created. You need to O_NOCTTY for your PTY when going across the boundary. Otherwise, the child process with the FD's mapped as stdin/out/err will become the controlling terminal for that PTY. Why this likely works with something like toolbox is simply because podman, underneath, is creating a sub-PTY for you (just like tmux would). |
Linux distribution and version
Fedora Silverblue 31
Flatpak version
flatpak-1.4.3-3.fc31.x86_64
Description of the problem
When calling
flatpak-spawn --host bash
from inside a flatpak, it cannot work properly:The final use case is to try to set the default terminal in flatpak'd VSCode to
flatpak-spawn --host toolbox enter
... and, of course, that it works.Steps to reproduce
flatpak-spawn --host bash
Other shells are even worse. Just try with
fish
for example, it doesn't work.The text was updated successfully, but these errors were encountered: