community.windows icon indicating copy to clipboard operation
community.windows copied to clipboard

win_unzip fails on files with a name ending in a tilde ~

Open coryasilva opened this issue 4 years ago • 2 comments

SUMMARY

win_unzip fails on files with a name ending in a tilde. (~)

~Probably due to this commit.~ ~https://github.com/ansible/ansible/pull/66972~

This is low priority but possibly a problem for a select few. Who the hell names a file ending in a tilde???

Move from https://github.com/ansible/ansible/issues/68964

ISSUE TYPE
  • Bug Report
COMPONENT NAME

win_unzip

ANSIBLE VERSION
ansible 2.9.6
  config file = /opt/ansible/ansible.cfg
  configured module search path = [u'/home/REDACTED/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Jun 11 2019, 14:33:56) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
CONFIGURATION
ANSIBLE_FORCE_COLOR(/REDACTED/REDACTED/ansible.cfg) = True
DEFAULT_HOST_LIST(/REDACTED/REDACTED/ansible.cfg) = [u'REDACTED']
HOST_KEY_CHECKING(REDACTED) = False
INVENTORY_ENABLED(REDACTED) = [u'ini']
OS / ENVIRONMENT

Windows Server 2016

STEPS TO REPRODUCE
  1. Create an archive file containing a file ending in a tilde
  2. unzip the archive on a windows host using win_unzip
- win_unzip:
    src: "blah.zip"
    dest: "tmp/"
EXPECTED RESULTS

It should still extract the file like version 2.8

ACTUAL RESULTS
fatal: [REDACTED]: FAILED! => {"changed": true, "dest": "c:\\REDACTED\\REDACTED/", "msg": "Error unzipping 'c:\\REDACTED\\REDACTED/REDACTED.zip' to 'c:\\REDACTED\\REDACTED/'! Filename contains relative paths which would extract outside the destination: c:\\REDACTED\\REDACTED/REDACTED/REDACTED/README.md~", "removed": false, "src": "c:\\REDACTED\\REDACTED/REDACTED.zip"}

coryasilva avatar Apr 17 '20 03:04 coryasilva

This would actually probably be due to https://github.com/ansible/ansible/pull/67799. I haven't really looked into it to see what the possible solution would be.

jborean93 avatar Apr 23 '20 00:04 jborean93

The file doesn't need to end with a tilde, it just needs to contain a tilde. A zip file containing the file alice~1.txt also causes this isse

The specific filename we are seeing an issue with is C__505~1.cab, with similarly named files regularly being part of larger installation media due to the way filenames are shortened to be compatible with the old 8.3 filename limitations (I'm sure a Windows expert can correct me there)

Interestingly, we don't see this issue when extracting the same file on Linux servers with ansible.builtin.unarchive

kaeraali-flutterint avatar Aug 18 '23 14:08 kaeraali-flutterint