flatpak-builder icon indicating copy to clipboard operation
flatpak-builder copied to clipboard

important environment variables are not inherited when using `--run`

Open 2-www opened this issue 1 year ago • 5 comments

Checklist

  • [X] I agree to follow the Code of Conduct that this project adheres to.
  • [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

flatpak-builder version

1.4.2

Flatpak version

1.14.6

How to reproduce

flatpak-builder --run app-build/ app.json env

Expected Behavior

environment variables such as WAYLAND_DISPLAY and XDG_SESSION_TYPE are not passed inside the sandbox, which makes most programs unable to run

Actual Behavior

files such as $XDG_RUNTIME_DIR/wayland-0 are still available inside the sandbox, but the environment is cleared, so apps don't know that wayland is actually available

Additional Information

https://docs.flatpak.org/en/latest/debugging.html:

2-www avatar May 02 '24 21:05 2-www

You need to use the correct finish args

JakobDev avatar May 06 '24 13:05 JakobDev

i have "--socket=wayland", in finish-args. it works correctly if flatpak-builder --user --install && flatpak run. but flatpak-builder --run app fails because it doesn't have the needed variables

2-www avatar May 06 '24 22:05 2-www

I think it's the best to just install the App and not use flatpak-builder --run. This feature is sadly broken. Portals sometimes don't work correct, but I don't knew that even Wayland was not working.

JakobDev avatar May 07 '24 06:05 JakobDev

i read about it at https://docs.flatpak.org/en/latest/debugging.html i want to use gdb, and --install doesn't install debug symbol files

2-www avatar May 07 '24 20:05 2-www

It seems --run does not pass XDG_SESSION_TYPE variable. Passing it manually with --env fixed the issue and my app runs.

junalmeida avatar Dec 15 '24 01:12 junalmeida