Package: libtext-markdown-perl / 1.000031-3

seed_rng.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Description: seed random number generator during package builds
 to make output of users reproducible
Origin: vendor
Bug-Debian: https://bugs.debian.org/947708
Forwarded: not-needed
Author: Chris Lamb <lamby@debian.org>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2019-12-29

--- a/lib/Text/Markdown.pm
+++ b/lib/Text/Markdown.pm
@@ -1463,6 +1463,8 @@
     return $text;
 }
 
+my $SRAND_CALLED = 0;
+
 sub _EncodeEmailAddress {
 #
 #   Input: an email address, e.g. "foo@example.com"
@@ -1481,6 +1483,11 @@
 
     my ($self, $addr) = @_;
 
+    if ($ENV{SOURCE_DATE_EPOCH} and not $SRAND_CALLED) {
+        srand $ENV{SOURCE_DATE_EPOCH};
+        $SRAND_CALLED = 1;
+    }
+
     my @encode = (
         sub { '&#' .                 ord(shift)   . ';' },
         sub { '&#x' . sprintf( "%X", ord(shift) ) . ';' },