Bug 973691 - Wrong LC_* settings for environment variables
Summary: Wrong LC_* settings for environment variables
Keywords:
Status: CLOSED UPSTREAM
Alias: None
Product: Fedora
Classification: Fedora
Component: gnome-settings-daemon
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Bastien Nocera
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-06-12 13:54 UTC by Tim Waugh
Modified: 2013-06-13 12:09 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-06-13 12:09:37 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNOME Bugzilla 701322 0 None None None Never

Description Tim Waugh 2013-06-12 13:54:03 UTC
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 14:09:38 UTC
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 15:58:34 UTC
Maybe this is the fix?

-REGION=${SETTING//\,/}
+REGION=${SETTING//\'/}

Comment 3 Jeff Bastian 2013-06-12 17:41:43 UTC
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 17:42:53 UTC
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 12:09:37 UTC
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.