Project

General

Profile

Feature #12625

Feature #5630: Reproducible builds

Make Ikiwiki resize images deterministically

Added by anonym 4 months ago. Updated 13 days ago.

Status:
In Progress
Priority:
Normal
Assignee:
Category:
-
Target version:
Start date:
05/31/2017
Due date:
% Done:

50%

QA Check:
Feature Branch:
Type of work:
Code
Blueprint:
Easy:
Affected tool:

Description

As seen in #12566, if we do something like:

[[!img introduction_to_gnome_and_the_tails_desktop/keyboard.png size="267x" link="no" alt="Menu in the top-right corner of the desktop to switch between different keyboard layouts"]]

the resulting resized image contains a timestamp => breaks reproducibility.

Ikiwiki does the resizing in IkiWiki/Plugin/img.pm, using an interface to ImageMagick. I think Ikiwiki just have to tell PerlMagick to do the equivalent of convert +set date:create +set date:modify -define png:exclude-chunk=time to fix this.

The two +set ... things can be accomplished with:

--- a/IkiWiki/Plugin/img.pm
+++ b/IkiWiki/Plugin/img.pm
@@ -174,6 +174,9 @@ sub preprocess (@) {
                my $r = $im->Read("$format:$srcfile\[$pagenumber]");
                error sprintf(gettext("failed to read %s: %s"), $file, $r) if $r;

+                $im->Set('date:create' => NULL);
+                $im->Set('date:modify' => NULL);
+
                if (! defined $im->Get("width") || ! defined $im->Get("height")) {
                        error sprintf(gettext("failed to get dimensions of %s"), $file);
                }

but perhaps we only want to do this if SOURCE_DATE_EPOCH is set, and then set it to that value instead of NULL?

Note that we still may need to find how to tell PerlMagick to do -define png:exclude-chunk=time.


Related issues

Related to Tails - Bug #12566: ikiwiki image size specification makes the ISO build unreproducible Resolved 05/19/2017

Associated revisions

Revision 14a77e5a (diff)
Added by anonym 4 months ago

Don't resize image.

When Ikiwiki resizes it a timestamp is added which breaks
reproducibility.

Refs: #12625
Will-fix: #12566

History

#1 Updated by intrigeri 4 months ago

  • Parent task set to #5630

#2 Updated by intrigeri 4 months ago

  • Related to Bug #12566: ikiwiki image size specification makes the ISO build unreproducible added

#3 Updated by intrigeri 4 months ago

  • Target version set to Tails_3.2

#4 Updated by anonym 4 months ago

  • Status changed from Confirmed to In Progress

#5 Updated by intrigeri 3 months ago

  • Status changed from In Progress to Confirmed

#6 Updated by intrigeri 19 days ago

anonym wrote:

Note that we still may need to find how to tell PerlMagick to do -define png:exclude-chunk=time.

According to the doc, setting the option attribute with the Set method allows one to "associate an option with an image format (e.g. option=>'ps:imagemask'". I guess that's what we want :)

#7 Updated by intrigeri 19 days ago

  • Status changed from Confirmed to In Progress
  • Target version changed from Tails_3.2 to Tails_3.3
  • % Done changed from 0 to 50

Submitted merge request (with unit test included) upstream: https://ikiwiki.info/bugs/images_resizing_is_not_deterministic/. I'll come back to it during the next cycle if it's not merged yet. Note that our website does not expose this issue anymore, so wrt. SponsorT, having submitted a fix upstream is already pretty good.

#8 Updated by anonym 13 days ago

intrigeri wrote:

Submitted merge request (with unit test included) upstream: https://ikiwiki.info/bugs/images_resizing_is_not_deterministic/. I'll come back to it during the next cycle if it's not merged yet. Note that our website does not expose this issue anymore, so wrt. SponsorT, having submitted a fix upstream is already pretty good.

You rock! \o/

Also available in: Atom PDF