[Reproducible-commits] [discount] 120/121: Add a patch to provide a stable output for email addresses
Jérémy Bobbio
lunar at moszumanska.debian.org
Tue Sep 23 20:56:23 UTC 2014
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/reproducible_builds
in repository discount.
commit d6b2f6bf4e96bfca9f8baeefe37fe6726e44d589
Author: Jérémy Bobbio <lunar at debian.org>
Date: Tue Sep 23 22:42:19 2014 +0200
Add a patch to provide a stable output for email addresses
---
...ovide-a-stable-output-for-email-addresses.patch | 58 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 59 insertions(+)
diff --git a/debian/patches/02_provide-a-stable-output-for-email-addresses.patch b/debian/patches/02_provide-a-stable-output-for-email-addresses.patch
new file mode 100644
index 0000000..c0128e9
--- /dev/null
+++ b/debian/patches/02_provide-a-stable-output-for-email-addresses.patch
@@ -0,0 +1,58 @@
+From 503fb7de2fe26eaf126ce7698931434517a3d418 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Bobbio?= <lunar at debian.org>
+Date: Tue, 23 Sep 2014 16:56:46 +0000
+Subject: [PATCH] Provide a stable output for email address accross runs
+
+Email adresses were previously mangled randomly. This prevented two runs of
+discount from providing the same output. This is problematic for software
+using discount and compare its output to some reference, or for software which
+wants to generate documentation in a reproducible manner.
+
+We can assume that the current code is trying to defeat an email address
+scraper that supports one encoding but not the other. Simply alternating
+between the two encodings would accomplish the same effect.
+
+We thus change the behaviour of the `mangle()` function to alternate the
+encoding based on the position in the string instead of randomly. As there is
+no other users of the `COINTOSS()` macro, we can remove its definition from the
+configure script.
+---
+ configure.sh | 8 --------
+ generate.c | 2 +-
+ 2 files changed, 1 insertion(+), 9 deletions(-)
+
+diff --git a/configure.sh b/configure.sh
+index 44c8986..8d009f4 100755
+--- a/configure.sh
++++ b/configure.sh
+@@ -105,14 +105,6 @@ else
+ AC_FAIL "$TARGET requires bzero or memset"
+ fi
+
+-if AC_CHECK_FUNCS random; then
+- AC_DEFINE 'COINTOSS()' '(random()&1)'
+-elif AC_CHECK_FUNCS rand; then
+- AC_DEFINE 'COINTOSS()' '(rand()&1)'
+-else
+- AC_DEFINE 'COINTOSS()' '1'
+-fi
+-
+ if AC_CHECK_FUNCS strcasecmp; then
+ :
+ elif AC_CHECK_FUNCS stricmp; then
+diff --git a/generate.c b/generate.c
+index 7180a1e..0935f78 100644
+--- a/generate.c
++++ b/generate.c
+@@ -775,7 +775,7 @@ mangle(char *s, int len, MMIOT *f)
+ {
+ while ( len-- > 0 ) {
+ Qstring("&#", f);
+- Qprintf(f, COINTOSS() ? "x%02x;" : "%02d;", *((unsigned char*)(s++)) );
++ Qprintf(f, (len % 2 == 0) ? "x%02x;" : "%02d;", *((unsigned char*)(s++)) );
+ }
+ }
+
+--
+2.1.0
+
diff --git a/debian/patches/series b/debian/patches/series
index 1bba799..d6db608 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
01_honour-build-flags.patch
+02_provide-a-stable-output-for-email-addresses.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/discount.git
More information about the Reproducible-commits
mailing list