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
[Bug]: Subsandbox should base its environment on the environment of the original flatpak run
#5278
Comments
Here is one possible way to solve this:
Implementation notes:
|
It also cannot just read the If we changed |
@smcv, have you had a chance to work on this? This issue breaks user expectation and typical workflows with apps that started relying on subsandboxes (Steam, Chromium-based, etc.). It's quite a nuisance. |
@smcv, a few questions:
|
@smcv, do you have an opinion on the above? |
If you're interested in working on this, please do!
If you have not seen replies from me, please assume "no". I have a lot of things on my to-do list, some of them are time-sensitive, and everyone wants their favourite issue to be my top priority.
If I had a chance to work on this, one of the pieces of work I would have been doing would be answering this question; but because I haven't, sorry, I don't have a definitive answer.
Yes, I believe other components like xdg-desktop-portal rely on We could potentially have some sort of Or mounting an empty file over the top for the container "view" of the file containing the environment would be another option.
I think as long as we inherit the environment from a host process, it doesn't have to be specifically
pressure-vessel already sets about a million environment variables inside the subsandbox ("below" The place where this really matters is when I would want to test the proposed PR with pressure-vessel to make sure there isn't something unexpected going on, because pressure-vessel is a heavy and specialized user of the subsandbox API, but I think what we've described here would be fine for it. |
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propogate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propogate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propogate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: flatpak#5278
Instead of inheriting the portal's environment when spawning a subsandbox using flatpak-run, inherit the environment in which flatpak-run was originally executed for the parent instance. This means that environment variables that affect the sandbox setup of the parent instance now also propagate to the setup of subsandboxes, including "FLATPAK_GL_DRIVERS". Closes: #5278
Checklist
Flatpak version
1.14.1
What Linux distribution are you using?
Other (specify below)
Linux distribution version
any
What architecture are you using?
x86_64
How to reproduce
Scenario 1: variables that are passed through unaltered by Flatpak
SOME_VARIABLE=portal /usr/libexec/flatpak-portal -vvr
SOME_VARIABLE=run flatpak run --command=bash org.gnome.Recipes
(any app will do)org.gnome.Recipes
shell:flatpak-spawn -- sh -c 'env|grep SOME_'
SOME_VARIABLE=run
is inherited fromflatpak run
SOME_VARIABLE=portal
is inherited fromflatpak-portal
Scenario 2: variables that are used internally by Flatpak
weston --socket temp-wayland-1 --backend=wayland-backend.so &
(or useXephyr :11
on X11 systems)weston --socket temp-wayland-2 --backend=wayland-backend.so &
(or useXephyr :22
on X11 systems)WAYLAND_DISPLAY=temp-wayland-1 /usr/libexec/flatpak-portal -vvr
(or useDISPLAY=:11
on X11 systems)WAYLAND_DISPLAY=temp-wayland-2 flatpak run --command=bash org.gnome.Recipes
(any Wayland GUI app will do; or useDISPLAY=:22
on X11 systems)org.gnome.Recipes
shell:gnome-recipes
org.gnome.Recipes
shell:flatpak-spawn -- gnome-recipes
gnome-recipes
windows appear inside the second Weston or Xephyrgnome-recipes
window inheritsWAYLAND_DISPLAY
orDISPLAY
fromflatpak run
and correctly appears inside the second Weston or Xephyr, but the secondgnome-recipes
window unexpectedly inheritsWAYLAND_DISPLAY
orDISPLAY
fromflatpak-portal
and appears inside the first Weston or Xephyr.Expected Behavior
(see above)
Actual Behavior
(see above)
Additional Information
In these illustrative examples I'm running
flatpak run
andflatpak-portal
manually, with obviously-different environment variables. The Wayland or X11 display is a highly-visible example which is convenient for testing, but this can happen for any environment variable.In real life,
flatpak run
would inherit its environment from the desktop environment (GNOME Shell or equivalent), or from a terminal where the user ranflatpak run
.Similarly, in real life,
flatpak-portal
would inherit its environment fromsystemd --user
on systemd systems, or fromdbus-daemon --session
on non-systemd.#4539 is closely related to this. If this issue was resolved, then that would solve 95% of #4539: the only thing remaining to be solved separately on #4539 would be to keep using the same specific commit of each extension as in the original app launch, even if it was no longer the latest.
#5271 is also closely related to this.
The text was updated successfully, but these errors were encountered: