Skip to content

Commit a71f78e

Browse files
authored
fix inoperative pathname argument of add_files method (#135)
The method ended up with an incoherent algorithm, trying to pop the `pathname` argument out of the extra keyword arguments despite this being impossible. A good static code analyzer could have detected this bug. Fixes #134. Signed-off-by: Nicholas Vinson <nvinson234@gmail.com>
1 parent a56e940 commit a71f78e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

libarchive/write.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,21 +77,20 @@ def add_files(
7777

7878
entry = ArchiveEntry(header_codec=self.header_codec)
7979
entry_p = entry._entry_p
80-
destination_path = attributes.pop('pathname', None)
8180
for path in paths:
8281
with new_archive_read_disk(path, flags, lookup) as read_p:
8382
while 1:
8483
r = read_next_header2(read_p, entry_p)
8584
if r == ARCHIVE_EOF:
8685
break
8786
entry_path = entry.pathname
88-
if destination_path:
87+
if pathname:
8988
if entry_path == path:
90-
entry_path = destination_path
89+
entry_path = pathname
9190
else:
9291
assert entry_path.startswith(path)
9392
entry_path = join(
94-
destination_path,
93+
pathname,
9594
entry_path[len(path):].lstrip('/')
9695
)
9796
entry.pathname = entry_path.lstrip('/')

0 commit comments

Comments
 (0)