bug-xorriso
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 0/2] Make ISO file output more reproducible


From: henrik
Subject: Re: [PATCH 0/2] Make ISO file output more reproducible
Date: Sat, 31 Aug 2024 19:53:12 +0200
User-agent: Loopia Webmail/1.6.6

Thomas pointed out that the copyright situation of my patches is unclear.

I hereby add
  Signed-off-by: Henrik Lindström <henrik@lxm.se>
to this patch set and hand over the copyright for it to
  Thomas Schmitt <scdbackup@gmx.net>

On 2024-08-31 12:28, Henrik Lindström wrote:
Hi,

It seems like some effort has been put into this already, because i was able to build reproducible ISO files as long as i built them from the same system.

However, when building from two different systems, one with glibc and one with musl, their different qsort implementations would sometimes affect the output.

To debug this i wanted to reproduce it on a single system, so i wrote the following simple "qsort" which is very unstable. It's just an insertion sort
that reverses all equal elements:
#include <stdint.h>
#include <string.h>
#include <stdio.h>

void qsort(void *base, size_t nel, size_t width, int (*compar)(const void *, const void *)) {
    char *array = base;
    for (size_t i = 1; i < nel; ++i) {
        char elem[4096];
        memcpy(&elem[0], &array[i * width], width);
        size_t curr = i;
        do {
            void *prev = &array[(curr - 1) * width];
if (compar(&elem[0], prev) > 0) break; // Would normally be >=, but we don't want stability.
            memcpy(&array[curr * width], prev, width);
        } while(--curr > 0);
        memcpy(&array[curr * width], &elem[0], width);
    }
}

This allowed me to swap out the libc qsort with LD_PRELOAD=./my_qsort.so I could then reproduce the problem with the following xorriso command, by
running it with and without my qsort:
SOURCE_DATE_EPOCH=0 TZ=UTC0 LC_ALL=C xorriso -as mkisofs -V TEST -o test.iso --norock -graft-points "files=/usr/include/linux" -- -alter_date_r b =0 / --

This helped me find two issues which i have attempted to create patches for.

Henrik Lindström (2):
  Make ECMA-119 tree sorting deterministic
  Make the filelist weight sort stable

 libisofs/ecma119.c      |  4 ++--
 libisofs/ecma119_tree.c | 21 ++++++++++++++++++++-
 libisofs/filesrc.c      |  6 +++++-
 libisofs/filesrc.h      | 10 ++++++----
 4 files changed, 33 insertions(+), 8 deletions(-)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]