Why does gdm-x-session source my .profile twice?

Previous discussion from January 2022:

A bad decision was made in Fedora 30 to fix a cockpit bug (1615131 , #12803) by moving PATH customizations from .bash_profile to .bashrc (commit , PR).

.bashrc is supposed to be only for interactive shells. .bash_profile should source .bashrc only if interactive:

 # .bash_profile
 
 # Get the aliases and functions
-if [ -f ~/.bashrc ]; then
-	. ~/.bashrc
-fi
+case "$-" in *i*)
+  if [ -f ~/.bashrc ]; then
+    . ~/.bashrc
+  fi;;
+esac
 
 # User specific environment and startup programs
2 Likes