Hi Niko, > As seen in #931730 this is not the first time this kind of issue > comes up. Back in 2019 File::StripNondeterminism::handlers::zip was > changed to use Sub::Override instead of the earlier Monkey::Patch > because the latter introduced a similar build cycle. > > Getting rid of monkeypatching Archive::Zip altogether as tracked in > https://salsa.debian.org/reproducible-builds/strip-nondeterminism/-/issues/8 > would probably be the best fix. > > Alternatively, finding yet another way of the monkeypatching > Archive::Zip at runtime would work around this for hopefully > at least another few years :) After looking at the code I think that the easiest way to avoid monkey patching at all would be inheritance. I haven't found enough time to work on the full implementation yet, but this is the general idea: * File/StripNondeterminism/handlers/zip.pm defines 2 packages: File::StripNondeterminism::handlers::zip itself and a subclass of Archive::Zip::Member which is local (e.g. Local::AZM). * Also defines methods cdExtraField and localExtraField calling to super class methods first and then normalize_extra_fields if needed. * Replaces `Archive::Zip->new()` with `Local::AZM->new()`. Monkey patching without importing other packages is also doable, but I think inheritance is cleaner here. Cheers, Alex -- ⢀⣴⠾⠻⢶⣦⠀ ⣾⠁⢠⠒⠀⣿⡁ Alex Muntada <alexm@debian.org> ⢿⡄⠘⠷⠚⠋ Debian Developer 🍥 log.alexm.org ⠈⠳⣄⠀⠀⠀⠀
Attachment:
signature.asc
Description: PGP signature