[gnome-session: 1/2] gnome-session: avoid setting LC_ unless LANG and region disagree



commit 73b9aa3a602606b32c328f5feb3a75dfca848c5a
Author: Takao Fujiwara <tfujiwar redhat com>
Date:   Tue Oct 22 20:44:04 2019 +0900

    gnome-session: avoid setting LC_ unless LANG and region disagree
    
    At the moment, gnome-session explicitly sets the various LC_ variables
    to the user configured region.
    
    That's unnecessary, though.  If the LC_ variables are unset,
    applications know to use LANG.  Furthermore, setting the LC_ variables
    makes it so you can't override them with LANG anymore.
    
    This commit makes sure the LC_ variables only get set when absolutely
    necesary. That is, when they are different than LANG.
    
    https://gitlab.gnome.org/GNOME/gnome-session/issues/37

 gnome-session/gnome-session.in | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/gnome-session/gnome-session.in b/gnome-session/gnome-session.in
index 7ded3594..edec0ae0 100755
--- a/gnome-session/gnome-session.in
+++ b/gnome-session/gnome-session.in
@@ -18,11 +18,15 @@ REGION=${SETTING#\'}
 REGION=${REGION%\'}
 
 if [ -n "$REGION" ]; then
-  export LC_TIME=$REGION
-  export LC_NUMERIC=$REGION
-  export LC_MONETARY=$REGION
-  export LC_MEASUREMENT=$REGION
-  export LC_PAPER=$REGION
+  unset LC_TIME LC_NUMERIC LC_MONETARY LC_MEASUREMENT LC_PAPER
+
+  if [ "$LANG" != "$REGION" ] ; then
+    export LC_TIME=$REGION
+    export LC_NUMERIC=$REGION
+    export LC_MONETARY=$REGION
+    export LC_MEASUREMENT=$REGION
+    export LC_PAPER=$REGION
+  fi
 fi
 
 exec @libexecdir@/gnome-session-binary "$@"


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]