commit:     43c399629fb022b7519d70194cb6c0364809764d
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 31 15:20:09 2024 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Mar 31 15:20:09 2024 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=43c39962

app-arch/libarchive: Backport tar error handling fix

Closes: https://bugs.gentoo.org/928146
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../files/libarchive-3.7.2-safe-fprintf.patch      | 27 ++++++++++++++++++++++
 ...-3.7.2-r2.ebuild => libarchive-3.7.2-r3.ebuild} |  2 ++
 2 files changed, 29 insertions(+)

diff --git a/app-arch/libarchive/files/libarchive-3.7.2-safe-fprintf.patch 
b/app-arch/libarchive/files/libarchive-3.7.2-safe-fprintf.patch
new file mode 100644
index 000000000000..6a351ba37fea
--- /dev/null
+++ b/app-arch/libarchive/files/libarchive-3.7.2-safe-fprintf.patch
@@ -0,0 +1,27 @@
+From 6110e9c82d8ba830c3440f36b990483ceaaea52c Mon Sep 17 00:00:00 2001
+From: Ed Maste <[email protected]>
+Date: Fri, 29 Mar 2024 18:02:06 -0400
+Subject: [PATCH] tar: make error reporting more robust and use correct errno
+ (#2101)
+
+As discussed in #1609.
+---
+ tar/read.c | 5 +++--
+ 1 file changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/tar/read.c b/tar/read.c
+index af3d3f423..a7f14a07b 100644
+--- a/tar/read.c
++++ b/tar/read.c
+@@ -371,8 +371,9 @@ read_archive(struct bsdtar *bsdtar, char mode, struct 
archive *writer)
+                       if (r != ARCHIVE_OK) {
+                               if (!bsdtar->verbose)
+                                       safe_fprintf(stderr, "%s", 
archive_entry_pathname(entry));
+-                              fprintf(stderr, ": %s: ", 
archive_error_string(a));
+-                              fprintf(stderr, "%s", strerror(errno));
++                              safe_fprintf(stderr, ": %s: %s",
++                                  archive_error_string(a),
++                                  strerror(archive_errno(a)));
+                               if (!bsdtar->verbose)
+                                       fprintf(stderr, "\n");
+                               bsdtar->return_value = 1;

diff --git a/app-arch/libarchive/libarchive-3.7.2-r2.ebuild 
b/app-arch/libarchive/libarchive-3.7.2-r3.ebuild
similarity index 98%
rename from app-arch/libarchive/libarchive-3.7.2-r2.ebuild
rename to app-arch/libarchive/libarchive-3.7.2-r3.ebuild
index 0e17daa7457c..5387e642a60c 100644
--- a/app-arch/libarchive/libarchive-3.7.2-r2.ebuild
+++ b/app-arch/libarchive/libarchive-3.7.2-r3.ebuild
@@ -76,6 +76,8 @@ PATCHES=(
        # https://github.com/libarchive/libarchive/issues/2069
        # (we can simply update the command since we don't support old lrzip)
        "${FILESDIR}/${P}-lrzip.patch"
+       # https://github.com/libarchive/libarchive/pull/2101
+       "${FILESDIR}/${P}-safe-fprintf.patch"
 )
 
 src_prepare() {

Reply via email to