Why does ansible change LANG to C?

725 views
Skip to first unread message

Alistair Bayley

unread,
Apr 10, 2014, 9:43:36 PM4/10/14
to ansible...@googlegroups.com
We've tracked down a bug in our ansible-driven build to the LANG environment variable being explicitly set to "C". I'm wondering why this is done i.e. why modify it at all? Why not just use the environment of the user/account executing the ansible script? It was confusing, because running the same commands manually from the ansible user account did not reproduce the fault.

I found this post:
which says that it is done to avoid encoding issues; which is ironic, as it has caused us encoding issues...

We've set module_lang = en_NZ.UTF-8 in ansible.cfg for now.

Michael DeHaan

unread,
Apr 15, 2014, 5:06:24 PM4/15/14
to ansible...@googlegroups.com
It's done because various modules rely on parsing Unix commands and these commands are difficult to parse in different languages.

The proposal has been made that if LANG is set in the environment, we possibly not set LANG, though we'll need to consider implications.

It may be that only certain modules need to set the LANG to C, so it may warrant reading history and audit specifically what changes may have to occur.






--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7aa2587f-423f-450c-87bd-d3b107d1978f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Strahinja Kustudić

unread,
Apr 17, 2014, 5:47:01 PM4/17/14
to ansible...@googlegroups.com
The first modules that should use the default system LANG are command and shell. Having them as C can give a lot of problems, especially if you are inserting something into a database which is UTF8.

Michael DeHaan

unread,
Apr 17, 2014, 6:20:37 PM4/17/14
to ansible...@googlegroups.com
I'd agree especially for those.

Please make sure there's a ticket filed if you can't find one already.   We'll probably want to research a bit more which specifically should make modifications.




Strahinja Kustudić

unread,
Apr 18, 2014, 4:05:49 PM4/18/14
to ansible...@googlegroups.com
Issue 7060 created.
Reply all
Reply to author
Forward
0 new messages