Source: markdown
Version: 1.0.2~b8-6
Severity: wishlist
Tags: patch
User: reproducible-bui...@lists.alioth.debian.org
Usertags: randomness toolchain
X-Debbugs-Cc: reproducible-b...@lists.alioth.debian.org

Hi,

Whilst working on the Reproducible Builds effort [0] we noticed that
markdown generates output that is not reproducible.

Specifically it encodes some email addresses using random HTML
entities in an attempt to thwart spammers. A patch is attached that
seeds the random number generation with a deterministic value based on
SOURCE_DATE_EPOCH [1].

  [0] https://reproducible-builds.org/
  [1] https://reproducible-builds.org/specs/source-date-epoch/


Regards,

-- 
      ,''`.
     : :'  :     Chris Lamb
     `. `'`      la...@debian.org / chris-lamb.co.uk
       `-
diff --git a/Markdown.pl b/Markdown.pl
index 62e0dfe..0325049 100755
--- a/Markdown.pl
+++ b/Markdown.pl
@@ -1338,7 +1338,7 @@ sub _EncodeEmailAddress {
 
        my $addr = shift;
 
-       srand;
+       srand($ENV{SOURCE_DATE_EPOCH} || time);
        my @encode = (
                sub { '&#' .                 ord(shift)   . ';' },
                sub { '&#x' . sprintf( "%X", ord(shift) ) . ';' },

Reply via email to