Skip to content
This repository has been archived by the owner on Oct 30, 2018. It is now read-only.

Commit

Permalink
Don't add included files as arguments on the command line (#4626)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
dagwieers authored and resmo committed Sep 12, 2016
1 parent f07e3d2 commit c776932
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions files/unarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,7 @@ def is_unarchived(self):
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:
Expand Down Expand Up @@ -545,12 +546,12 @@ def unarchive(self):
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)
Expand Down

0 comments on commit c776932

Please sign in to comment.