Bug 437012

Summary: Wrong language when LANG and LC_MESSAGES differ...
Product: [Fedora] Fedora Reporter: Dmitry Butskoy <dmitry>
Component: cupsAssignee: Tim Waugh <twaugh>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: low Docs Contact:
Priority: low    
Version: 10Keywords: Patch
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-30 14:47:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 438944    
Attachments:
Description Flags
Proposed patch none

Description Dmitry Butskoy 2008-03-11 16:57:21 UTC
All F7,F8 and rawhide versions seem to be affected (1.2.12-1.3.6)

Preamble:

There is a wide-spread locale settings, popular for developers, where the LANG
is set according to the true native language (as usual), but LC_MESSAGES is set
to "C" . 

This way programs know the local language and character set properly, but all
the messages for a user are in English (because of "C" locale), not the native
language.


Unfortunately, the Cups code interpretes LC_MESSAGES in some non-standard way.
It tries to determine the WHOLE locale language first just by LC_MESSAGES (not
by LC_ALL or LANG, as it should be). It seems not correct anyway.

In the currect Cups code, if you set in /etc/sysconfig/i18n, say
LANG=de_DE.UTF-8 and LC_MESSAGES=C , the "attributes-natural-languages" appears
to be "c-" broken string. Then the LANG variable in the Cups filters and
backends appears as "c-" too, which leads to leak of locale support at all.

The LANG/LC_MESSAGES combination above is correct. Cups must know the actual
locale language (and choose proper fonts, encodings etc.), but the user/logfile
messages ONLY (diagnostic, info etc.) should be in "C" locale.


Steps to Reproduce:

1. Wrote a shell wrapper around any of /usr/lib/cups/filters/, say texttopaps,
which will output the actual runtime environment

#!/bin/sh

env >>/tmp/env.dump
exec $0.orig "$@"


2. Print something (which will touch the wrapped filter) with the locale
settings described above:

LANG=de_DE.UTF-8 LC_MESSAGES=C lpr some_file


3. In the /tmp/env.dump you will see the "LANG=c-" strange values...

I've made a patch, which seems to fix the issue. See the patch and comments in
it for more info.

Comment 1 Dmitry Butskoy 2008-03-11 16:57:22 UTC
Created attachment 297644 [details]
Proposed patch

Comment 2 Bug Zapper 2008-05-14 05:57:05 UTC
Changing version to '9' as part of upcoming Fedora 9 GA.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Tim Waugh 2008-05-28 09:23:08 UTC
Deferring to rawhide.

Comment 4 Dmitry Butskoy 2008-08-14 15:21:05 UTC
Since Fedora 8 (ie. cups-1.3.7), the wrong language now appears as "c-.UTF8" instead of "c-". This ".UTF8" seems to improve the situation.

IOW, whilst the issue still exists (formally wrong LANG variable), this issue no more affects the end user, as the "magic addon" of ".UTF8" causes all the backends to work properly.

If you have a contact, please, report this upstream. Then I think we can "close upstream" this one...

Comment 5 Bug Zapper 2008-11-26 02:09:00 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.

More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 6 Tim Waugh 2009-07-30 14:47:09 UTC
In Fedora 10 it seems to be 'C.UTF8', which at least seems valid.