Hi,

i explored two ways to get a correct and complete md5sum.txt after
merging and sorting:

- Generating the whole md5sum.txt from the emerging ISO's file tree is
  possible by help of xorriso, although there is no file tree yet where
  all regular files of the ISO can be found for checksumming.
  But this would work only for MD5 and not for SHA256, because xorriso
  has no API function to compute SHA256. (libjte has SHA256 but not as
  API. There are many xorrisos out there which are not linked to libjte.)
  Run time would be mediocre: 36 seconds for DVD-1+2+3 on a 500MB/s SSD.
  (find+md5sum on mounted result ISO needs 27 seconds. But as said there
   is no result ISO to mount when the script makes md5sum.txt.)

- Removing duplicates from md5sum.txt and identifying those files which
  possibly have a changed MD5 after the merging activities is more error
  prone but signficantly faster.
  Especially it can be easily modified when Debian decides to retire
  md5sum.txt in favor of a sha256sum.txt.
  Run time is still annoying: 8 seconds with dash, 12 seconds with bash.
  As it is now it works with echo | grep.
  I could reduce it to less than a second by using the bashism
  ${Var:Offset:Count} to obtain a substring of the file paths.

Run time for an All-in-one ISO is estimated about 6 to 7 times the time
of DVD-1+2+3.
So i expect ~230 seconds for full MD5 regeneration, ~ 50 seconds for
a loop that runs on dash, and ~6 seconds with a bashism.

For now i decided to take the 50 seconds with dash.

The merged md5sum.txt is not 100% complete. Files in ./firmware which
appear in more than one input ISO will not be listed, because it is not
100% clear from which ISO the one stems which survives the competition.
It appears that the check in
  https://salsa.debian.org/installer-team/cdrom-checker/-/raw/master/main.c
does not insist in a complete list. It only demands that all listed files
exist and yield the listed MD5 when being checksummed.

I tested the correctness of the merged md5sum.txt of DVD-1+2+3 by mounting
the result as /mnt/iso and running what i deem equivalent to the MD5 check
in installer-team/cdrom-checker :

  (cd /mnt/iso
   cat md5sum.txt | while read line
   do
     if echo -n "$line" | md5sum -c 1>/dev/null 2>&1
     then
       dummy=dummy
     else
       echo "BAD: $line"
     fi
   done ) 2>&1 | wc

Result from wc was "0 0 0" (after 47 seconds).

Regrettably i cannot check this with my dummy DLBD-1+2 ISO, because its
data files nearly all have fake content.

Committed changes:
  
https://dev.lovelyhq.com/libburnia/libisoburn/commit/0bc397c02c0ea7c960b59ce92daa267bed23fc07


Have a nice day :)

Thomas

Reply via email to