Bug 417050 - Launched programs are missing env vars under X
Summary: Launched programs are missing env vars under X
Status: REPORTED
Alias: None
Product: krunner
Classification: Plasma
Component: general (show other bugs)
Version: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: Kai Uwe Broulik
URL:
Keywords:
: 421833 (view as bug list)
Depends on:
Blocks:
 
Reported: 2020-02-02 09:28 UTC by Pau Ruiz Safont
Modified: 2020-06-15 17:13 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pau Ruiz Safont 2020-02-02 09:28:34 UTC
SUMMARY
Programs launched with krunner on X are missing environment variables compared to using the app launcher and wayland.
This results in broken theming because DESKTOP_SESSION is not set.

STEPS TO REPRODUCE
1. launch a plasma X session
2. invoke krunner 
3. type konsole and press enter
4. run printenv > krunner.out
5. click on the menu button 
6. type konsole and press enter
7. run printenv > applauncher.out
8. run diff -u krunner.out applauncher.out

OBSERVED RESULT
There are a lot of environment variables present in applauncher.out that are missing in krunner.out:

DESKTOP_SESSION
DESKTOP_SESSION
KDE_FULL_SESSION
KDE_SESSION_UID
KDE_SESSION_VERSION
PAM_KWALLET5_LOGIN
QT_AUTO_SCREEN_SCALE_FACTOR
SESSION_MANAGER
XCURSOR_SIZE
XCURSOR_THEME
XDG_CURRENT_DESKTOP
XDG_DATA_DIRS
XDG_SEAT
XDG_SEAT_PATH
XDG_SESSION_CLASS
XDG_SESSION_DESKTOP
XDG_SESSION_ID
XDG_SESSION_PATH
XDG_SESSION_TYPE
XDG_VTNR

The path variable is incorrectly set and missing a lot of directories
-PATH=/home/pau/.local/bin:/home/pau/.local/share/go/bin:/home/pau/.local/share/cargo/bin:/home/pau/code/misc/scripts:/usr/local/bin:/usr/bin
+PATH=/home/pau/.local/bin:/home/pau/.local/share/go/bin:/home/pau/.local/share/cargo/bin:/home/pau/code/misc/scripts:/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/android-sdk/emulator:/opt/android-ndk:/opt/android-sdk/platform-tools:/opt/android-sdk/tools:/opt/android-sdk/tools/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl

EXPECTED RESULT
when doing the same procedure on wayland we see only the following differences, which is more reasonable:
$ diff -u wayland_krunner wayland_app_launcher
-DBUS_STARTER_ADDRESS=unix:abstract=/tmp/dbus-cTW2sJ38w5,guid=a7191eb7c568d2893ba3c0c65e369089
-DBUS_STARTER_BUS_TYPE=session
-KONSOLE_DBUS_SERVICE=:1.51
+KONSOLE_DBUS_SERVICE=:1.54
+SESSION_MANAGER=local/alnitak:@/tmp/.ICE-unix/7823,unix/alnitak:/tmp/.ICE-unix/7823
-SHELL_SESSION_ID=bf533c89b8974b4b87b52947c7b27690
+SHELL_SESSION_ID=05b7d42477244cf6be81077e6f1fcc85

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch
KDE Plasma Version: 5.17.5 
KDE Frameworks Version: 5.66.0
Qt Version: 5.14.1
Comment 1 Alexander Lohnau 2020-06-14 17:24:02 UTC
*** Bug 421833 has been marked as a duplicate of this bug. ***
Comment 2 Alexander Lohnau 2020-06-15 16:24:20 UTC
Is this still reproducible in 5.19+?

I ran the instructions you provided on X11 and it worked as expected.
Comment 3 Pau Ruiz Safont 2020-06-15 17:13:25 UTC
This still happens to me:

KDE Plasma Version: 5.19.0
KDE Frameworks Version: 5.70.0
Qt Version: 5.14.1

On https://bugs.kde.org/show_bug.cgi?id=421833 a more detailed explanation is given: sourcing the file https://github.com/trapd00r/LS_COLORS/blob/master/LS_COLORS on bashrc (or fish.init in my case) produces this behaviour.