Hello!

I took a look at the patch and attached a small patch fix for it.
I hope this helps!

Jia Tan
From 0f03dce25f174725e80dcd78bfa6ddd640b3714a Mon Sep 17 00:00:00 2001
From: Jia Tan <jiat0...@gmail.com>
Date: Sun, 10 Mar 2024 22:16:20 +0800
Subject: [PATCH] pristine-xz: Fix -T1 fallback if threads not specified.

---
 pristine-xz | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/pristine-xz b/pristine-xz
index 2046578..f3a8eab 100755
--- a/pristine-xz
+++ b/pristine-xz
@@ -403,7 +403,14 @@ sub genxz {
   }
 
   my @params = split(' ', $delta->{params});
+
+  # Flag indicating if the threads were set in the params file. If
+  # the threads were not set, then default back to single threaded
+  # mode. This is necessary for backwards compatibility with .xz files
+  # created before XZ Utils 5.6.0, when the default threading mode was
+  # changed to multi-threading (which produces different output).
   my $threads_set = 0;
+
   while (@params) {
     my $param = shift @params;
 
@@ -416,11 +423,12 @@ sub genxz {
       next if $param eq '--check=crc64';
       next if $param eq '--check=sha256';
       next if $param =~ /^(--block-list=[0-9,]+)$/;
-      next if $param =~ /^-T[0-9]+$/;
+
+      # Set $threads_set before checking next argument.
       if ($param =~ /^-T[0-9]+$/) {
-			$threads_set = 1;
-			next;
-		}
+        $threads_set = 1;
+        next;
+      }
     } elsif ($delta->{program} eq 'pixz') {
       next if $param eq '-t';
     }
-- 
2.34.1

Reply via email to