Source: mah-jong
Version: 1.17.2-3
Severity: wishlist
Tags: patch
X-Debbugs-Cc: [email protected]
User: [email protected]
Usertags: randomness

Hi!

While working on the “reproducible builds” effort, we have noticed that
that mah-jong does not build reproducible:

https://reproduce.debian.net/amd64/forky.html#mah-jong

This is due to randomness in the proto-encode-msg.pl code generator.

The attached patch fixes this and makes the package reproducible.

Cheers Jochen
diff --git a/debian/patches/0006-Generate-reproducible-proto-msg-code.patch 
b/debian/patches/0006-Generate-reproducible-proto-msg-code.patch
new file mode 100644
index 0000000..6c13e59
--- /dev/null
+++ b/debian/patches/0006-Generate-reproducible-proto-msg-code.patch
@@ -0,0 +1,30 @@
+From: Jochen Sprickerhof <[email protected]>
+Date: Mon, 29 Jun 2026 07:51:26 +0200
+Subject: Generate reproducible proto msg code
+
+---
+ proto-encode-msg.pl | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/proto-encode-msg.pl b/proto-encode-msg.pl
+index bb3a97f..2dd895d 100644
+--- a/proto-encode-msg.pl
++++ b/proto-encode-msg.pl
+@@ -185,7 +185,7 @@ print SIZE
+   switch ( m->type ) {
+ ";
+ 
+-foreach $k ( keys %charstar ) {
++foreach $k ( sort keys %charstar ) {
+   $c = $charstar{$k};
+   print SIZE
+ "  case ${L}Msg$k:
+@@ -214,7 +214,7 @@ print SIZE
+   switch ( m->type ) {
+ ";
+ 
+-foreach $k ( keys %charstar ) {
++foreach $k ( sort keys %charstar ) {
+   $c = $charstar{$k};
+   print SIZE
+ "  case ${L}Msg$k:
diff --git a/debian/patches/series b/debian/patches/series
index def71a9..129fd83 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ Makefile.in.Hardening.patch
 gui.c-fix-typo.patch
 0001-Port-GUI-from-GTK-2-to-GTK-3.patch
 cross.patch
+0006-Generate-reproducible-proto-msg-code.patch

Reply via email to