Issue 1:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

ansible 2.1.0.0
config file = /home/tessio/ansible/next/ansible.cfg
configured module search path = Default w/o overrides

UNZIP VERSION

caution: both -n and -o specified; ignoring -o
UnZip 6.00 of 20 April 2009, by Debian. Original by Info-ZIP.

Latest sources and executables are at ftp://ftp.info-zip.org/pub/infozip/ ;
see ftp://ftp.info-zip.org/pub/infozip/UnZip.html for other sites.

Compiled with gcc 5.2.1 20151010 for Unix (Linux ELF).

UnZip special compilation options:
ACORN_FTYPE_NFS
COPYRIGHT_CLEAN (PKZIP 0.9x unreducing method not supported)
SET_DIR_ATTRIB
SYMLINKS (symbolic links supported, if RTL and file system permit)
TIMESTAMP
UNIXBACKUP
USE_EF_UT_TIME
USE_UNSHRINK (PKZIP/Zip 1.x unshrinking method supported)
USE_DEFLATE64 (PKZIP 4.x Deflate64(tm) supported)
UNICODE_SUPPORT [wide-chars, char coding: UTF-8] (handle UTF-8 paths)
LARGE_FILE_SUPPORT (large files over 2 GiB supported)
ZIP64_SUPPORT (archives using Zip64 for large files supported)
USE_BZIP2 (PKZIP 4.6+, using bzip2 lib version 1.0.6, 6-Sept-2010)
VMS_TEXT_CONV
WILD_STOP_AT_DIR
[decryption, version 2.11 of 05 Jan 2007]

UnZip and ZipInfo environment options:
UNZIP: [none]
UNZIPOPT: [none]
ZIPINFO: [none]
ZIPINFOOPT: [none]

CONFIGURATION

[defaults]
hostfile = hosts

OS / ENVIRONMENT

Distributor ID: Ubuntu
Description: Ubuntu 15.10
Release: 15.10
Codename: wily
Ansible package from Ansibles Inc's PPA.

SUMMARY

unarchive module fails to extract zip files that contain files whose name has spaces in it, like the file named "CPL - cpl1.0.txt".

STEPS TO REPRODUCE

Download jboss-5.1.0.GA-jdk6.zip, then try to copy and extract it to another machine using ansible.

This was how I discovered the bug, but I got the same result when I created archive.zip with a file named "bug - bug.txt" and the command "zip archive bug\ -\ bug.txt".

---
- name: install e configure Jboss 5.1
hosts: sig
become: yes
vars:
java_home: /opt/java/jdk1.6.0_45
jboss_home: /opt/jboss/jboss-5.1.0.GA
jboss_package: jboss-5.1.0.GA-jdk6.zip

tasks:
- name: install dependencies
apt: name=unzip state=present update_cache=yes

- name: send archive
copy: src=files/{{ jboss_package }} dest=/tmp mode=0664
register: package

- name: check copy
fail: msg="bad copy"
when: package.checksum != "0906717eec83d57a3fdbdf090555cac036bffc6d"

- name: create dir
file: path=/opt/jboss state=directory mode=0755

- name: extract archive
unarchive: src=/tmp/{{ jboss_package }} dest=/opt/jboss copy=no

EXPECTED RESULTS

Files inside the zip archive to be extracted to the remote host.

ACTUAL RESULTS

ansible fails while extracting the zip file. It always fail when it's encounters a ziped file whose name has spaces in it.

fatal: [pinky]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"backup": null, "content": null, "copy": false, "creates": null, "delimiter": null, "dest": "/opt/jboss", "directory_mode": null, "exclude": [], "extra_opts": [], "follow": false, "force": null, "group": null, "keep_newer": false, "list_files": false, "mode": null, "original_basename": "jboss-5.1.0.GA-jdk6.zip", "owner": null, "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/tmp/jboss-5.1.0.GA-jdk6.zip"}}, "msg": "Unexpected error when accessing exploded file: [Errno 2] No such file or directory: '/opt/jboss/jboss-5.1.0.GA/docs/licenses/CPL - cpl1.0.txt'"}

Issue 2:
ISSUE TYPE

Bug Report

ANSIBLE VERSION

problematic

ansible 2.1.0.0

working fine

ansible 2.0.2.0

ansible 1.9.6

CONFIGURATION

default pip install ansible==2.1.0.0

OS / ENVIRONMENT

controller: fedora 23

host: centos 7 & fedora 23

SUMMARY

if the archive contains files with spaces, the module fails.

STEPS TO REPRODUCE

I made a reproducer.

git clone https://github.com/sherl0cks/test-travis.git

ansible-playbook tests/unarchive-bug.yml -i tests/inventory

EXPECTED RESULTS

unarchive handles all sorts of file name permuations without issue. In this case, tests/files/licenses.zip should archive to a folder with 19 different files in it.

FWIW - unzip seems to work just fine on fedora 23 and centos 7 for the same files.

ACTUAL RESULTS

only 2 files (the ones with no spaces in their names) unarchive, which seems to result in an error.

[sherl0cks@fedora23 test-travis]$ ansible-playbook tests/unarchive-bug.yml -i tests/inventory -vvvv
Using /home/sherl0cks/.ansible.cfg as config file
Loaded callback default of type stdout, v2.0

PLAYBOOK: unarchive-bug.yml ****************************************************
1 plays in tests/unarchive-bug.yml

PLAY [Unarchive fails with files with spaces] **********************************

TASK [setup] *******************************************************************
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: sherl0cks
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.05-143065043354798 `" && echo ansible-tmp-1464668529.05-143065043354798="` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.05-143065043354798 `" ) && sleep 0'
<localhost> PUT /tmp/tmpyrzj2X TO /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.05-143065043354798/setup
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.05-143065043354798/setup; rm -rf "/home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.05-143065043354798/" > /dev/null 2>&1 && sleep 0'
ok: [localhost]

TASK [unarchive] ***************************************************************
task path: /home/sherl0cks/Code/ansible/test-travis/tests/unarchive-bug.yml:5
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: sherl0cks
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.51-147273438565075 `" && echo ansible-tmp-1464668529.51-147273438565075="` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.51-147273438565075 `" ) && sleep 0'
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.58-72180718843273 `" && echo ansible-tmp-1464668529.58-72180718843273="` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.58-72180718843273 `" ) && sleep 0'
<localhost> PUT /tmp/tmpFEYESf TO /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.58-72180718843273/stat
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.58-72180718843273/stat; rm -rf "/home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.58-72180718843273/" > /dev/null 2>&1 && sleep 0'
<localhost> PUT /home/sherl0cks/Code/ansible/test-travis/tests/files/licenses.zip TO /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.51-147273438565075/source
<localhost> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.77-102978787354324 `" && echo ansible-tmp-1464668529.77-102978787354324="` echo $HOME/.ansible/tmp/ansible-tmp-1464668529.77-102978787354324 `" ) && sleep 0'
<localhost> PUT /tmp/tmpnRb93m TO /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.77-102978787354324/unarchive
<localhost> EXEC /bin/sh -c 'LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.77-102978787354324/unarchive; rm -rf "/home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.77-102978787354324/" > /dev/null 2>&1 && sleep 0'
<localhost> EXEC /bin/sh -c 'rm -f -r /home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.51-147273438565075/ > /dev/null 2>&1 && sleep 0'
fatal: [localhost]: FAILED! => {"changed": false, "failed": true, "invocation": {"module_args": {"backup": null, "content": null, "copy": true, "creates": null, "delimiter": null, "dest": "/tmp", "directory_mode": null, "exclude": [], "extra_opts": [], "follow": false, "force": null, "group": null, "keep_newer": false, "list_files": false, "mode": null, "original_basename": "licenses.zip", "owner": null, "regexp": null, "remote_src": null, "selevel": null, "serole": null, "setype": null, "seuser": null, "src": "/home/sherl0cks/.ansible/tmp/ansible-tmp-1464668529.51-147273438565075/source"}}, "msg": "path /tmp/licenses/gnu general public license, version 2 - gpl-2.0.txt does not exist", "path": "/tmp/licenses/gnu general public license, version 2 - gpl-2.0.txt", "state": "absent"}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @tests/unarchive-bug.retry

PLAY RECAP *********************************************************************
localhost : ok=1 changed=0 unreachable=0 failed=1