summaryrefslogtreecommitdiffstats
path: root/lib/ansible/modules/unarchive.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:16:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-05 16:16:49 +0000
commit48e387c5c12026a567eb7b293a3a590241c0cecb (patch)
tree80f2573be2d7d534b8ac4d2a852fe43f7ac35324 /lib/ansible/modules/unarchive.py
parentReleasing progress-linux version 2.16.6-1~progress7.99u1. (diff)
downloadansible-core-48e387c5c12026a567eb7b293a3a590241c0cecb.tar.xz
ansible-core-48e387c5c12026a567eb7b293a3a590241c0cecb.zip
Merging upstream version 2.17.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'lib/ansible/modules/unarchive.py')
-rw-r--r--lib/ansible/modules/unarchive.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/ansible/modules/unarchive.py b/lib/ansible/modules/unarchive.py
index b3e8058..6c51f1d 100644
--- a/lib/ansible/modules/unarchive.py
+++ b/lib/ansible/modules/unarchive.py
@@ -7,8 +7,7 @@
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
-from __future__ import absolute_import, division, print_function
-__metaclass__ = type
+from __future__ import annotations
DOCUMENTATION = r'''
@@ -283,6 +282,7 @@ MISSING_FILE_RE = re.compile(r': Warning: Cannot stat: No such file or directory
ZIP_FILE_MODE_RE = re.compile(r'([r-][w-][SsTtx-]){3}')
INVALID_OWNER_RE = re.compile(r': Invalid owner')
INVALID_GROUP_RE = re.compile(r': Invalid group')
+SYMLINK_DIFF_RE = re.compile(r': Symlink differs$')
def crc32(path, buffer_size):
@@ -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:
@@ -880,6 +887,8 @@ class TgzArchive(object):
out += line + '\n'
if INVALID_GROUP_RE.search(line):
out += line + '\n'
+ if SYMLINK_DIFF_RE.search(line):
+ out += line + '\n'
if out:
unarchived = False
return dict(unarchived=unarchived, rc=rc, out=out, err=err, cmd=cmd)
@@ -969,6 +978,7 @@ class TarZstdArchive(TgzArchive):
class ZipZArchive(ZipArchive):
def __init__(self, src, b_dest, file_args, module):
super(ZipZArchive, self).__init__(src, b_dest, file_args, module)
+ # NOTE: adds 'l', which is default on most linux but not all implementations
self.zipinfoflag = '-Zl'
self.binaries = (
('unzip', 'cmd_path'),