Bug 973691 - Wrong LC_* settings for environment variables
Wrong LC_* settings for environment variables
Status: CLOSED UPSTREAM
Product: Fedora
Classification: Fedora
Component: gnome-settings-daemon (Show other bugs)
19
Unspecified Unspecified
unspecified Severity unspecified
: ---
: ---
Assigned To: Bastien Nocera
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2013-06-12 09:54 EDT by Tim Waugh
Modified: 2013-06-13 08:09 EDT (History)
7 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-06-13 08:09:37 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
GNOME Desktop 701322 None None None Never

  None (edit)
Description Tim Waugh 2013-06-12 09:54:03 EDT
Description of problem:
The gnome-settings-daemon environment incorrectly contains single quotes for LC_* variables, leading to locale errors in applications launched from keyboard shortcuts.

Version-Release number of selected component (if applicable):
gnome-settings-daemon-3.8.3-2.fc19.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Set a keyboard shortcut to launch gnome-terminal (Settings, Keyboard->Shortcuts, Custom Shortcuts, Launch Terminal with "gnome-terminal")
2.Now invoke that keyboard shortcut
3.In the resulting gnome-terminal window, run 'locale'
4.Close that window
5.Now start Terminal from overview mode (Meta, "terminal", Enter)
6.Repeat step 3.

Actual results:
When invoked from keyboard shortcut,
$ locale
locale: Cannot set LC_ALL to default locale: No such file or directory
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC=\'en_GB.utf8\'
LC_TIME=\'en_GB.utf8\'
LC_COLLATE="en_GB.utf8"
LC_MONETARY=\'en_GB.utf8\'
LC_MESSAGES="en_GB.utf8"
LC_PAPER=\'en_GB.utf8\'
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT=\'en_GB.utf8\'
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=

When invoked from overview mode,
$ locale
LANG=en_GB.utf8
LC_CTYPE="en_GB.utf8"
LC_NUMERIC=en_GB.utf8
LC_TIME=en_GB.utf8
LC_COLLATE="en_GB.utf8"
LC_MONETARY=en_GB.utf8
LC_MESSAGES="en_GB.utf8"
LC_PAPER=en_GB.utf8
LC_NAME="en_GB.utf8"
LC_ADDRESS="en_GB.utf8"
LC_TELEPHONE="en_GB.utf8"
LC_MEASUREMENT=en_GB.utf8
LC_IDENTIFICATION="en_GB.utf8"
LC_ALL=

Expected results:
The overview mode-invoked terminal gives the correct output.

Additional info:
$ ps axf | grep [g]nome-settings-daemon
28474 ?        Sl     0:00              \_ /usr/libexec/gnome-settings-daemon
$ cat /proc/28474/environ | xargs -0rn1 | grep LC_
LC_PAPER='en_GB.utf8'
LC_MONETARY='en_GB.utf8'
LC_NUMERIC='en_GB.utf8'
LC_MEASUREMENT='en_GB.utf8'
LC_TIME='en_GB.utf8'

No other programs in the session have these incorrect settings.
Comment 1 Tim Waugh 2013-06-12 10:09:38 EDT
Probably due to this, from gnome-settings-daemon-localeexec.in:

SETTING=$(gsettings get org.gnome.system.locale region)
REGION=${SETTING//\,/}

if [ -n "$REGION" ]; then
  export LC_TIME=$REGION
  export LC_NUMERIC=$REGION
  export LC_MONETARY=$REGION
  export LC_MEASUREMENT=$REGION
  export LC_PAPER=$REGION
fi

Running that locally I get:

$ gsettings get org.gnome.system.locale region
'en_GB.utf8'
Comment 2 Tim Waugh 2013-06-12 11:58:34 EDT
Maybe this is the fix?

-REGION=${SETTING//\,/}
+REGION=${SETTING//\'/}
Comment 3 Jeff Bastian 2013-06-12 13:41:43 EDT
I have a simple ~/.i18n file:
LANG="en_US.UTF-8"
LC_COLLATE="C"

Whenever I open a shell, I get two errors:

bash: warning: setlocale: LC_NUMERIC: cannot change locale (''): No such file or directory
bash: warning: setlocale: LC_TIME: cannot change locale (''): No such file or directory

And I have a bunch of LC_* variables that are set to literal single-quotes:

$ env | grep LC
LC_PAPER=''
LC_MONETARY=''
LC_NUMERIC=''
LC_COLLATE=C
LC_MEASUREMENT=''
LC_TIME=''

In other desktops like Xfce or Cinnamon, I only have LC_COLLATE=C set (which is as expected from ~/.i18n)
Comment 4 Jeff Bastian 2013-06-12 13:42:53 EDT
If I remove my ~/.i18n file, the errors go away and I'm left with only LC_COLLATE=C set.
Comment 5 Rui Matos 2013-06-13 08:09:37 EDT
Fixed upstream: https://bugzilla.gnome.org/show_bug.cgi?id=701322 .

Note You need to log in before you can comment on or make changes to this bug.