diff options
author | Jonathan Neuhauser <jonathan.hofinger@gmx.de> | 2021-12-14 18:31:01 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-14 12:31:01 -0500 |
commit | 49e1cb9f42fef6953c39ef0dd88470c361fce6a9 (patch) | |
tree | d7f6c565f989762b512551a88c326e29b4026753 /test/integration/targets/unarchive | |
parent | 146a4bcd0dd9fd3f6995562411bb9996d5424bba (diff) | |
download | ansible-49e1cb9f42fef6953c39ef0dd88470c361fce6a9.tar.gz |
unarchive: fix non-english locales (#76542)
* 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
Diffstat (limited to 'test/integration/targets/unarchive')
-rw-r--r-- | test/integration/targets/unarchive/tasks/main.yml | 1 | ||||
-rw-r--r-- | test/integration/targets/unarchive/tasks/test_different_language_var.yml | 41 |
2 files changed, 42 insertions, 0 deletions
diff --git a/test/integration/targets/unarchive/tasks/main.yml b/test/integration/targets/unarchive/tasks/main.yml index 035a556150..baa2a8cf22 100644 --- a/test/integration/targets/unarchive/tasks/main.yml +++ b/test/integration/targets/unarchive/tasks/main.yml @@ -17,3 +17,4 @@ - import_tasks: test_symlink.yml - import_tasks: test_download.yml - import_tasks: test_unprivileged_user.yml +- import_tasks: test_different_language_var.yml diff --git a/test/integration/targets/unarchive/tasks/test_different_language_var.yml b/test/integration/targets/unarchive/tasks/test_different_language_var.yml new file mode 100644 index 0000000000..1d7d3f60a2 --- /dev/null +++ b/test/integration/targets/unarchive/tasks/test_different_language_var.yml @@ -0,0 +1,41 @@ +- name: test non-ascii with different LANGUAGE + when: ansible_os_family == 'Debian' + block: + - name: install de language pack + apt: + name: language-pack-de + state: present + + - name: create our unarchive destination + file: + path: "{{ remote_tmp_dir }}/test-unarchive-nonascii-くらとみ-tar-gz" + state: directory + + - name: test that unarchive works with an archive that contains non-ascii filenames + unarchive: + # Both the filename of the tarball and the filename inside the tarball have + # nonascii chars + src: "test-unarchive-nonascii-くらとみ.tar.gz" + dest: "{{ remote_tmp_dir }}/test-unarchive-nonascii-くらとみ-tar-gz" + mode: "u+rwX,go+rX" + remote_src: no + register: nonascii_result0 + + - name: Check that file is really there + stat: + path: "{{ remote_tmp_dir }}/test-unarchive-nonascii-くらとみ-tar-gz/storage/àâæçéèïîôœ(copy)!@#$%^&-().jpg" + register: nonascii_stat0 + + - name: Assert that nonascii tests succeeded + assert: + that: + - "nonascii_result0.changed == true" + - "nonascii_stat0.stat.exists == true" + + - name: remove nonascii test + file: + path: "{{ remote_tmp_dir }}/test-unarchive-nonascii-くらとみ-tar-gz" + state: absent + + environment: + LANGUAGE: de_DE:en
\ No newline at end of file |