Hi Vasyl

On 2021-07-02 08:14:34 +0000, Vasyl Gello wrote:
> Hi Sebastian!
> 
> > I'm not sure why the second patch is needed. If I understand the first
> > patch correctly, in the case where LC_CTYPE is set to a Turkish locale,
> > the locale will be reset to C.UTF-8 (not sure that this is sane,
> > though). The second patch makes it even worse since it resets it to
> > C.UTF-8 for everyone else as well.
> 
> This is intended. Kodi internally expects to start with classic C locale and 
> after language pack is loaded, Kodi's global locale is set to the desired 
> locale.
> The root cause of the bug is incorrect comparison of skin's includes.xml 
> involving lowercase translation of file name (see upstream issue #19883, 
> linked)
> So there are two scenarios possible when the bug can manifest:
> 
> 1. LC_TYPE is set to a locale where "Turkish I" is effective (tr_*, az_AZ) 
> and user chooses Kodi language other than Turkish / Azeri.
> In this case, the locale is set to C + overrides from LC_CTYPE / LANG / 
> LC_ALL, so it becomes C + CTYPE("tr_TR.UTF-8"). The setlocale() call enforces 
> this "franken-locale" and the tolower("Includes.xml") produces "Includes.xml" 
> as per Turkish CTYPE rules, and not "inclides.xml" as expected.

So what you're telling me is that this tolower call should actually be
call to tolower_l with an appropriate locale as kodi only expects
tolower("...") == "includes.xml" under the C locale.

Cheers

> 
> 2. LC_* and LANG is set to arbitrary locale and user chooses Turkish / Azeri 
> language.
> In this case, the locale is set to whatever the environment variables declare 
> first, but then "CLangInfo::CRegion::SetGlobalLocale" sets global locale to 
> "tr_TR.UTF-8" and Kodi interface gets completely broken due to failed XML 
> substitutions etc.
> 
> That's why the first patch is not enough and I had to add the second one to 
> enforce Kodi's internal expectation to start with POSIX locale.
> 
> Mattia asked the same question, BTW :) The resolution looks odd at the first 
> glance as experienced users might expect Kodi to display UI in language 
> controlled by LANG or LC_ALL environment variable, but with Kodi, the 
> language is controlled by Settings -> Skin - Region -> Language and only by 
> that means, because unlike coreutils, language packs are shipped in form of 
> Kodi addons from central Kodi repository (https://mirrors.kodi.tv) and not as 
> a collection of PO files.
> 
> -- 
> Vasyl Gello
> ==================================================
> Certified SolidWorks Expert
> 
> Mob.:+380 (98) 465 66 77
> 
> E-Mail: vasek.ge...@gmail.com
> 
> Skype: vasek.gello
> ==================================================
> 호랑이는 죽어서 가죽을 남기고 사람은 죽어서 이름을 남긴다

-- 
Sebastian Ramacher

Reply via email to