From 7dde4901d42e4c043adbd980c941b97cd3237bb6 Mon Sep 17 00:00:00 2001 From: Gods Date: Tue, 21 Nov 2023 18:48:31 -0600 Subject: [PATCH] unarchive: support 8 character permission strings (#81705) --- changelogs/fragments/81699-zip-permission.yml | 2 ++ lib/ansible/modules/unarchive.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 changelogs/fragments/81699-zip-permission.yml 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: