Bug 442298 - kdeinit5 always auto modify environment variable "GTK2_RC_FILES" and "GTK_RC_FILES"
Summary: kdeinit5 always auto modify environment variable "GTK2_RC_FILES" and "GTK_RC_...
Status: RESOLVED FIXED
Alias: None
Product: frameworks-kinit
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-09-11 09:18 UTC by hosxy
Modified: 2022-07-23 16:45 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description hosxy 2021-09-11 09:18:25 UTC
SUMMARY
kdeinit5 will overwrite environment variable "GTK2_RC_FILES" and "GTK_RC_FILES".
I think kde shouldn't modify environment variable that defined by user manually.
And could you please add something behind user defined even if whatever you will modify it.

STEPS TO REPRODUCE
1. add "export GTK2_RC_FILES=${XDG_CONFIG_HOME}/gtk-2.0/gtkrc" and 
       "export GTK_RC_FILES=${XDG_CONFIG_HOME}/gtk-2.0/gtkrc" into "~/.config/plasma-workspace/env/desktop.sh"
2. logout and login


OBSERVED RESULT
use command "echo $GTK2_RC_FILES" and "echo $GTK_RC_FILES", I find
$GTK2_RC_FILES is "/etc/gtk-2.0/gtkrc:/home/skyarch/.gtkrc-2.0:/home/skyarch/.config/gtk-2.0/gtkrc:/home/skyarch/.config/gtkrc-2.0" and
$GTK_RC_FILES is "/etc/gtk/gtkrc:/home/skyarch/.gtkrc:/home/skyarch/.config/gtk-2.0/gtkrc:/home/skyarch/.config/gtkrc"

EXPECTED RESULT
the value of $GTK2_RC_FILES is "/home/skyarch/.config/gtk-2.0/gtkrc" only.
the value of $GTK_RC_FILES is "/home/skyarch/.config/gtk-2.0/gtkrc" only.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Arch Linux
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.2
Comment 1 Rocket Aaron 2021-11-09 02:42:45 UTC
Those environment variables are set by krdb:
https://invent.kde.org/plasma/plasma-workspace/-/blob/v5.23.2/kcms/krdb/krdb.cpp#L113
and it's causing kde-gtk-config always create ~/.gtkrc-2.0 in my home directory, even if I don't have gtk2 installed at all.
I'm working on a patch to fix this behavior, would it be OK to just remove those 2 environmant variables? They're not present even in GNOME.
Comment 2 Bug Janitor Service 2022-07-12 13:38:35 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/1911
Comment 3 Nate Graham 2022-07-23 16:45:08 UTC
Git commit f3a4b45d9e62313c039d1532c192dcc370bd61e4 by Nate Graham, on behalf of Ahmad Samir.
Committed on 23/07/2022 at 16:19.
Pushed by ngraham into branch 'master'.

KRDB: don't override GTK2_RC_FILES or GTK_RC_FILES evn vars if already set
FIXED-IN: 5.26

M  +6    -1    kcms/krdb/krdb.cpp

https://invent.kde.org/plasma/plasma-workspace/commit/f3a4b45d9e62313c039d1532c192dcc370bd61e4