[PATCH 0/9] Fix thread safety issues in the environment

David Shea dshea at redhat.com
Tue Feb 10 09:12:19 UTC 2015


On 02/10/2015 09:52 AM, Vratislav Podzimek wrote:
> On Thu, 2015-02-05 at 15:20 +0100, David Shea wrote:
>> Short version: environment variables cannot be set in a multi-threaded
>> environment. It is ridiculous, and it has been a problem since the environment
>> was invented, and no one has a solution for it, and computers are the absolute
>> worst.
>>
>> There is one environment variable that was cannot get around having to set.
>> Python's gettext module, to determine the language to return, searches
>> $LANGUAGE, $LC_ALL, $LC_MESSAGES, and $LANG. This is completely different from
>> gettext() and friends in glibc, which, if there is nothing in $LANGUAGE, uses
>> the locale data set by setlocale, which is thread-safe. This means that if we
>> want translations to work in any python module that we do not control, we need
>> to modify the environment.
>>
>> So, possible solutions:
>>    1) write thread-safe versions of get/set/put/unsetenv, shoehorn it in with
>>       $LD_PRELOAD
>>    2) don't set any environment variables at all after starting threads,
>>       monkey-patch the gettext module to do the right thing
>>    3) don't set most environment variables, cross fingers and burn some sage
>>       before setting environment variables
>>
>> These patches implement #3.
>>
>> The last one is just a bonus. Did you know that nm-connection-editor wasn't run
>> in the language the user selected, but it totally could be? Now it is.
>>
>> All this needs to be ported to RHEL 7.2 with Related: rhbz#1188287
>>
>> David Shea (9):
>>    Add a pylint module to look for modifications to the environment
>>    Set $DISPLAY before threads are started.
>>    Add a method to set environment variables for child processes
> Cannot see this commit/patch. Is it only me or nobody has it?
>

I'll try resending it. It looks like the rest made it to the list, but I 
got a failure message about timeouts connecting to 
lists.fedorahosted.org for #3 for some reason.


More information about the anaconda-patches mailing list