Package: release.debian.org
Severity: normal
User: release.debian....@packages.debian.org
Usertags: unblock
X-Debbugs-Cc: a...@debian.org

Please unblock package xarchiver

[ Reason ]

Fix detection of zstd version 1.5.4 and later (#1032591)

[ Impact ]

Xarchiver won't be able to detect and decompress zstd archives.

[ Tests ]

Manual decompression of zstd archives with xarchiver works as expected
now.


[ Checklist ]
  [x] all changes are documented in the d/changelog
  [x] I reviewed all changes and I approve them
  [x] attach debdiff against the package in testing


unblock xarchiver/1:0.5.4.20-2
diff -Nru xarchiver-0.5.4.20/debian/changelog 
xarchiver-0.5.4.20/debian/changelog
--- xarchiver-0.5.4.20/debian/changelog 2022-11-12 14:36:12.000000000 +0100
+++ xarchiver-0.5.4.20/debian/changelog 2023-03-12 12:48:14.000000000 +0100
@@ -1,3 +1,9 @@
+xarchiver (1:0.5.4.20-2) unstable; urgency=medium
+
+  * Fix detection of zstd version 1.5.4 and later. (Closes: #1032591)
+
+ -- Markus Koschany <a...@debian.org>  Sun, 12 Mar 2023 12:48:14 +0100
+
 xarchiver (1:0.5.4.20-1) unstable; urgency=medium
 
   * New upstream version 0.5.4.20.
diff -Nru xarchiver-0.5.4.20/debian/patches/fix-detection-of-zstd.patch 
xarchiver-0.5.4.20/debian/patches/fix-detection-of-zstd.patch
--- xarchiver-0.5.4.20/debian/patches/fix-detection-of-zstd.patch       
1970-01-01 01:00:00.000000000 +0100
+++ xarchiver-0.5.4.20/debian/patches/fix-detection-of-zstd.patch       
2023-03-12 12:48:14.000000000 +0100
@@ -0,0 +1,79 @@
+From: Markus Koschany <a...@debian.org>
+Date: Sun, 12 Mar 2023 12:40:42 +0100
+Subject: fix detection of zstd
+
+Bug-Debian: https://bugs.debian.org/1032591
+Origin: 
https://github.com/ib/xarchiver/commit/a298cf82391e4b447e702d7e51078554253b1b8d
+---
+ src/gzip_et_al.c | 44 +++++++++++++++++++++++++++++++++++++++-----
+ 1 file changed, 39 insertions(+), 5 deletions(-)
+
+diff --git a/src/gzip_et_al.c b/src/gzip_et_al.c
+index 650d24a..c862b60 100644
+--- a/src/gzip_et_al.c
++++ b/src/gzip_et_al.c
+@@ -67,6 +67,40 @@ void xa_gzip_et_al_check_lrzip (const gchar *path)
+       g_free(output);
+ }
+ 
++static gboolean xa_gzip_et_al_zstd_option (const gchar *output, const gchar 
*option)
++{
++      const gchar *nl, *delim;
++      size_t op;
++
++      if (!output)
++              return FALSE;
++
++      nl = output;
++      op = strlen(option);
++
++      while ((nl = strchr(nl, '\n')))
++      {
++              nl++;
++
++              /* skip multiple leading spaces added since v1.5.4 */
++              while (*nl && (*nl == ' '))
++                      nl++;
++
++              if (!*nl)
++                      break;
++
++              if (strncmp(nl, option, op) == 0)
++              {
++                      delim = nl + op;
++
++                      if (*delim && (*delim == ' ' || (*delim == ',' && 
*++delim == ' ')))
++                              return TRUE;
++              }
++      }
++
++      return FALSE;
++}
++
+ gchar *xa_gzip_et_al_check_zstd (const gchar *compressor, const gchar 
*decompressor, gboolean *is_compressor)
+ {
+       gchar *path, *command, *output = NULL;
+@@ -82,18 +116,18 @@ gchar *xa_gzip_et_al_check_zstd (const gchar *compressor, 
const gchar *decompres
+       if (!path)
+               return NULL;
+ 
+-      command = g_strconcat(path, " -h", NULL);
++      command = g_strconcat(path, " -H", NULL);
+       g_spawn_command_line_sync(command, &output, NULL, NULL, NULL);
+       g_free(command);
+ 
+       /* check whether decompression is available */
+-      if (output && strstr(output, "\n -d "))
++      if (xa_gzip_et_al_zstd_option(output, "-d"))
+       {
+               if (found_compressor)
+-                      *is_compressor = (strstr(output, "\n -# ") != NULL);
++                      *is_compressor = xa_gzip_et_al_zstd_option(output, 
"-#");
+ 
+-              zstd_can_list = (strstr(output, "\n -l ") || strstr(output, 
"\n--list "));
+-              zstd_can_test = (strstr(output, "\n -t ") || strstr(output, 
"\n--test "));
++              zstd_can_list = xa_gzip_et_al_zstd_option(output, "-l");
++              zstd_can_test = (xa_gzip_et_al_zstd_option(output, "--test") || 
/* check short test option just in case */ xa_gzip_et_al_zstd_option(output, 
"-t"));
+       }
+       else   // useless
+       {
diff -Nru xarchiver-0.5.4.20/debian/patches/series 
xarchiver-0.5.4.20/debian/patches/series
--- xarchiver-0.5.4.20/debian/patches/series    1970-01-01 01:00:00.000000000 
+0100
+++ xarchiver-0.5.4.20/debian/patches/series    2023-03-12 12:48:14.000000000 
+0100
@@ -0,0 +1 @@
+fix-detection-of-zstd.patch

Reply via email to