From d1418af239446bc43790ac0401d5fa7173e12d55 Mon Sep 17 00:00:00 2001 From: Benoit Pierre Date: Sun, 8 Jun 2025 00:30:14 +0200 Subject: [PATCH] zip: fix writing with ZSTD compression MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When testing the feature with `bsdtar -acf test.zip --options zip:compression=zstd …` on a tree of ~100MB, the execution would appear to "hang" while writing a multi-gigabytes ZIP file. --- libarchive/archive_write_set_format_zip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c index 79bbf0335..19121b519 100644 --- a/libarchive/archive_write_set_format_zip.c +++ b/libarchive/archive_write_set_format_zip.c @@ -1952,10 +1952,11 @@ archive_write_zip_finish_entry(struct archive_write *a) } zip->entry_compressed_written += remainder; zip->written_bytes += remainder; - zip->stream.zstd.out.dst = zip->buf; if (zip->stream.zstd.out.pos != zip->stream.zstd.out.size) finishing = 0; + zip->stream.zstd.out.dst = zip->buf; zip->stream.zstd.out.size = zip->len_buf; + zip->stream.zstd.out.pos = 0; } while (finishing); ZSTD_freeCStream(zip->stream.zstd.context); break; -- 2.47.3