[mythtv] Help needed for RPM Fusion package modernizaton

Michael T. Dean mtdean at thirdcontact.com
Mon Jul 30 23:07:13 UTC 2012


On 07/30/2012 06:19 PM, Bill Meek wrote:
> On 07/30/2012 01:36 PM, Michael T. Dean wrote:
>> On 07/18/2012 02:03 PM, Bill Meek wrote:
> ...
>>> I use: test -f /etc/default/locale && . /etc/default/locale || true
>>> to set it properly LANG in the Upstart .conf file.
>>>
>>> In any case, I always set LANG to remove the info & warning messages
>>> in the backend (and frontend) log
> ...
>> It doesn't say "LC_ALL or LC_CTYPE or LANG variable(s)".
> ...
>
> Hi;
>
> Yes, definitely the case, But after you added setlocale() in:
> http://code.mythtv.org/trac/changeset/a63fc04, LC_CTYPE gets
> set correctly if LANG is set.
>
> In the *buntu world, setting LANG in the Upstart script is enough. Not
> that my disk space is that tight. The MythTV Wiki was updated in June
> to remove LC_ALL to match the mythbuntu version of that script.
>
> Thanks for commenting on this. I'd been meaning to go back and figure
> out why not setting LC_ALL didn't cause the warning message to fire.
>


Pretty sure you know this, but just in case, I'll mention that the 
setlocale() does not, er, set the locale--it only queries the 
currently-configured locale using the default mechanism used by glibc, 
which is a whole different set of code from the mechanism Qt uses to 
determine the locale.  This whole mess is a defensive strategy to do our 
best to make sure that Qt does the right thing (since we can't even ask 
Qt what it's done), so I highly recommend the 
"most-likely-to-always-work" approach.

Since you're not getting a warning when you start up, setlocale() is 
finding no LC_* values, so it falls back to checking LANG (standard 
approach for *glibc).  However, I can't/won't guaranteed that Qt is also 
using LANG's value before something else that's configured on your 
system.  I didn't code in all of the checks that are done by Qt (there 
are about 8 of them in a huge block of ugly code that even Qt's comments 
describe as a hack), but if you set LC_ALL (or at least LC_CTYPE) and 
LANG, Qt should do the right thing in at least the 2 places I know of 
where they're making decisions about character encoding and that can 
affect our code.

Mike


More information about the mythtv-dev mailing list