public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/libzip] f45: Fix regression adding and replacing files in torrentzip archives
@ 2026-10-09 12:32 Remi Collet
  0 siblings, 0 replies; only message in thread
From: Remi Collet @ 2026-10-09 12:32 UTC (permalink / raw)
  To: git-commits

          A new commit has been pushed.

          Repo   : rpms/libzip
          Branch : f45
          Commit : 181a79e0e05d8c6575ea4cbbbce52b510b298e9d
          Author : Remi Collet <remi@fedoraproject.org>
          Date   : 2026-10-09T14:32:20+02:00
          Stats  : +82/-1 in 2 file(s)
          URL    : https://src.fedoraproject.org/rpms/libzip/c/181a79e0e05d8c6575ea4cbbbce52b510b298e9d?branch=f45

          Log:
          Fix regression adding and replacing files in torrentzip archives

https://github.com/nih-at/libzip/issues/617

---
diff --git a/libzip.spec b/libzip.spec
index b368090..aaa1d5f 100644
--- a/libzip.spec
+++ b/libzip.spec
@@ -2,13 +2,15 @@
 
 Name:    libzip
 Version: 1.12
-Release: 1%{?dist}
+Release: 2%{?dist}
 Summary: C library for reading, creating, and modifying zip archives
 
 License: BSD-3-Clause
 URL:     https://libzip.org/
 Source0: https://libzip.org/download/libzip-%{version}.tar.xz
 
+Patch0:  upstream.patch
+
 BuildRequires:  gcc
 BuildRequires:  zlib-devel >= 1.1.2
 BuildRequires:  bzip2-devel
@@ -117,6 +119,10 @@ sed -e '/clone-fs-/d' \
 
 
 %changelog
+* Fri Oct  9 2026 Remi Collet <remi@remirepo.net> - 1.12-2
+- Fix regression adding and replacing files in torrentzip archives
+  https://github.com/nih-at/libzip/issues/617
+
 * Fri Oct  9 2026 Remi Collet <remi@remirepo.net> - 1.12-1
 - update to 1.12
 

diff --git a/upstream.patch b/upstream.patch
new file mode 100644
index 0000000..cf653a9
--- /dev/null
+++ b/upstream.patch
@@ -0,0 +1,75 @@
+From e3f6db9b8bc7a6ec403f64c7a86a9b162fd70705 Mon Sep 17 00:00:00 2001
+From: Dieter Baron <dillo@nih.at>
+Date: Fri, 9 Oct 2026 12:10:33 +0200
+Subject: [PATCH] Fix adding/replacing files in torrentzip archives.
+
+Fixes issue #617
+---
+ THANKS                    |  1 +
+ TODO.md                   | 10 +++++++++-
+ lib/zip_extra_field_api.c |  6 +++++-
+ 3 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/THANKS b/THANKS
+index 5d24db00f..7e4b8b834 100644
+--- a/THANKS
++++ b/THANKS
+@@ -48,6 +48,7 @@ Coverity
+ cryi
+ ctenter-scs
+ Dane Springmeyer
++Daniel Linjama
+ Daniel Russel
+ Ларионов Даниил
+ David Carlier
+diff --git a/TODO.md b/TODO.md
+index d838bbd8d..4bcfa441d 100644
+--- a/TODO.md
++++ b/TODO.md
+@@ -1,20 +1,28 @@
+ ## Tests
+ 
++### Infrastructure
++
+ - Make `ziptool` take command from stdin, one command per line.
+ - Add option to `ziptool` to not abort on errors.
+ - Find framework for C unit tests.
+ - Add test program for testing sources, which takes commands from stdin.
+ - Switch existing dedicated test programs to one of the above, where possible.
+ 
++### CI
++
+ - Add CI build with sanitizers enabled.
+ 
++### Specific Tests
++
++- Add test to add/replace/remove files in torrentzip archives.
++
+ ## Fuzzing
+ 
+ - improve AES and PKWARE encryption tests
+ - add more
+ - review memset() uses
+ 
+-### Torrentzip
++## Torrentzip
+ 
+ - Handle data sources with unknown uncompressed size: if we forced ZIP64 and don't need it, return specific error (so calling code can decide what to do (e. g. clear torrentzip flag and call `zip_close()` again)).
+ 
+diff --git a/lib/zip_extra_field_api.c b/lib/zip_extra_field_api.c
+index e2b22fd0b..775d2d62d 100644
+--- a/lib/zip_extra_field_api.c
++++ b/lib/zip_extra_field_api.c
+@@ -58,7 +58,11 @@ ZIP_EXTERN int zip_file_extra_field_delete(zip_t *za, zip_uint64_t idx, zip_uint
+         zip_error_set(&za->error, ZIP_ER_RDONLY, 0);
+         return -1;
+     }
+-    if (ZIP_WANT_TORRENTZIP(za)) {
++    /*
++      Since torrentzip does not allow extra fields, allow deleting all of them.
++      Also, this is used internally by zip_file_replace().
++     */
++    if (ZIP_WANT_TORRENTZIP(za) && (ef_idx != ZIP_EXTRA_FIELD_ALL || (flags & ZIP_EF_BOTH) != ZIP_EF_BOTH)) {
+         zip_error_set(&za->error, ZIP_ER_NOT_ALLOWED, 0);
+         return -1;
+     }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-09 12:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-09 12:32 [rpms/libzip] f45: Fix regression adding and replacing files in torrentzip archives Remi Collet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox