Don't add included files as arguments on the command line (#4626)
This means we will have to unarchive the complete archive if a single change is found. Unfortunately we cannot fix this for `unzip`, the only hope is a pure-python reimplementation. This fixes problems reported in the comments of #3810
This commit is contained in:
parent
3366a95765
commit
433dfd0c5b
1 changed files with 6 additions and 5 deletions
|
@ -440,6 +440,7 @@ class ZipArchive(object):
|
|||
elif stat.S_ISREG(st.st_mode) and timestamp < st.st_mtime:
|
||||
# Add to excluded files, ignore other changes
|
||||
out += 'File %s is newer, excluding file\n' % path
|
||||
self.excludes.append(path)
|
||||
continue
|
||||
else:
|
||||
if timestamp != st.st_mtime:
|
||||
|
@ -545,12 +546,12 @@ class ZipArchive(object):
|
|||
cmd = [ self.cmd_path, '-o', self.src ]
|
||||
if self.opts:
|
||||
cmd.extend(self.opts)
|
||||
if self.includes:
|
||||
# NOTE: Including (changed) files as arguments is problematic (limits on command line/arguments)
|
||||
# if self.includes:
|
||||
# NOTE: Command unzip has this strange behaviour where it expects quoted filenames to also be escaped
|
||||
cmd.extend(map(shell_escape, self.includes))
|
||||
# We don't need to handle excluded files, since we simply do not include them
|
||||
# if self.excludes:
|
||||
# cmd.extend([ '-x' ] + self.excludes ])
|
||||
# cmd.extend(map(shell_escape, self.includes))
|
||||
if self.excludes:
|
||||
cmd.extend([ '-x' ] + self.excludes)
|
||||
cmd.extend([ '-d', self.dest ])
|
||||
rc, out, err = self.module.run_command(cmd)
|
||||
return dict(cmd=cmd, rc=rc, out=out, err=err)
|
||||
|
|
Loading…
Reference in a new issue