This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=2143a237b02909d299bcd70b0f28dc0bfc49b7d1

commit 2143a237b02909d299bcd70b0f28dc0bfc49b7d1
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Dec 18 04:09:54 2022 +0100

    libdpkg: Pass -T+1 instead of -T1 to xz when compressing
    
    The xz -T1 option selects a single-threaded mode which generates different
    output than in multi-threaded mode. To avoid the non-reproducible output
    we pass -T+1 (supported with xz >= 5.4.0) to request multi-threaded
    mode with a single thread.
---
 lib/dpkg/compress.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/lib/dpkg/compress.c b/lib/dpkg/compress.c
index 3e81ee636..7627f589d 100644
--- a/lib/dpkg/compress.c
+++ b/lib/dpkg/compress.c
@@ -793,7 +793,15 @@ compress_xz(struct compress_params *params, int fd_in, int 
fd_out,
                command_add_arg(&cmd, "-e");
 
        if (params->threads_max > 0) {
-               threads_opt = str_fmt("-T%d", params->threads_max);
+               /* The xz -T1 option selects a single-threaded mode which
+                * generates different output than in multi-threaded mode.
+                * To avoid the non-reproducible output we pass -T+1
+                * (supported with xz >= 5.4.0) to request multi-threaded
+                * mode with a single thread. */
+               if (params->threads_max == 1)
+                       threads_opt = m_strdup("-T+1");
+               else
+                       threads_opt = str_fmt("-T%d", params->threads_max);
                command_add_arg(&cmd, threads_opt);
        }
 

-- 
Dpkg.Org's dpkg

Reply via email to