New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
unarchive: fix non-english locales #76542
Conversation
For GNU Gettext, the LANGUAGE environment variable takes precedence over LANG or LC_ALL. On systems where LANGUAGE was set to a non-english locale, the output of the tar command therefore not understood and the module failed silently ("changed": false, but the archive was not extracted).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a changelog and test for this? For the test you can copy https://github.com/ansible/ansible/blob/devel/test/integration/targets/unarchive/tasks/test_non_ascii_filename.yml#L32-L66 and set the LANGUAGE env var instead.
Thanks for having a look!
Alright, done. However it's a bit meaningless to set the LANGUAGE env var if the referenced language pack doesn't exist (and LANGUAGE=C yields the same result as LANGUAGE=en_US on my system). I added some code to ensure that the locale actually exists. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the changelog!
test/integration/targets/unarchive/tasks/test_different_languave_var.yml
Outdated
Show resolved
Hide resolved
test/integration/targets/unarchive/tasks/test_different_languave_var.yml
Outdated
Show resolved
Hide resolved
test/integration/targets/unarchive/tasks/test_different_language_var.yml
Show resolved
Hide resolved
…ge_var.yml Co-authored-by: Sloane Hertel <19572925+s-hertel@users.noreply.github.com>
@s-hertel Thanks for your review and assistance with my first MR here. I'll perform the changes you suggested also on my other MR that addresses the same issue. |
@joneuhauser Awesome first contribution, thanks for working on this! |
* unarchive: fix non-english locales For GNU Gettext, the LANGUAGE environment variable takes precedence over LANG or LC_ALL. On systems where LANGUAGE was set to a non-english locale, the output of the tar command therefore not understood and the module failed silently ("changed": false, but the archive was not extracted). * add tests * changelog
SUMMARY
For GNU Gettext, the LANGUAGE environment variable takes precedence over LANG or LC_ALL (http://www.gnu.org/savannah-checkouts/gnu/gettext/manual/html_node/The-LANGUAGE-variable.html#The-LANGUAGE-variable). On systems where LANGUAGE was set to a non-english locale, the output of the tar command was in that language, so the module didn't understand it. This lead to the module failing silently ("changed": false, but the archive was not extracted).
The issue is simply fixed by adding the LANGUAGE environment variable as well.
Tested with:
on Ubuntu 20.04, German system, i.e.
If you are affected by this issue, add
to your play.
ISSUE TYPE
COMPONENT NAME
unarchive
ADDITIONAL INFORMATION
Step by step reproduction: