diff --git a/changelogs/fragments/81699-zip-permission.yml b/changelogs/fragments/81699-zip-permission.yml new file mode 100644 index 00000000000..d7ca23fd9bc --- /dev/null +++ b/changelogs/fragments/81699-zip-permission.yml @@ -0,0 +1,2 @@ +bugfixes: + - unarchive - add support for 8 character permission strings for zip archives (https://github.com/ansible/ansible/pull/81705). \ No newline at end of file diff --git a/lib/ansible/modules/unarchive.py b/lib/ansible/modules/unarchive.py index 82137d261f3..0fbdc1d643e 100644 --- a/lib/ansible/modules/unarchive.py +++ b/lib/ansible/modules/unarchive.py @@ -500,7 +500,8 @@ class ZipArchive(object): continue # Check first and seventh field in order to skip header/footer - if len(pcs[0]) != 7 and len(pcs[0]) != 10: + # 7 or 8 are FAT, 10 is normal unix perms + if len(pcs[0]) not in (7, 8, 10): continue if len(pcs[6]) != 15: continue @@ -552,6 +553,12 @@ class ZipArchive(object): else: permstr = 'rw-rw-rw-' file_umask = umask + elif len(permstr) == 7: + if permstr == 'rwxa---': + permstr = 'rwxrwxrwx' + else: + permstr = 'rw-rw-rw-' + file_umask = umask elif 'bsd' in systemtype.lower(): file_umask = umask else: