Bug#836157: jessie-pu: gnome-sudoku/1:3.14.1-1+deb8u1
Package: release.debian.org
User: release.debian.org@packages.debian.org
Usertags: pu
Tags: jessie
Severity: normal
gnome-sudoku had a bug where it would generate the same sequence of
puzzles every time the app was run. I'm applying the patch included
upstream in 3.18.3.
Thanks,
Jeremy Bicha
=== modified file 'debian/changelog'
--- debian/changelog 2016-08-31 01:41:59 +0000
+++ debian/changelog 2016-08-31 01:44:04 +0000
@@ -1,3 +1,12 @@
+gnome-sudoku (1:3.14.1-1+deb8u1) stable; urgency=medium
+
+ * Team upload
+ * debian/patches/generate_new_puzzles.patch:
+ - Don't generate the same puzzle sequence every time.
+ Closes: #828106
+
+ -- Jeremy Bicha <jbicha@ubuntu.com> Tue, 30 Aug 2016 15:23:30 -0400
+
gnome-sudoku (1:3.14.1-1) unstable; urgency=medium
[ Jackson Doak ]
=== added directory 'debian/patches'
=== added file 'debian/patches/generate_new_puzzles.patch'
--- debian/patches/generate_new_puzzles.patch 1970-01-01 00:00:00 +0000
+++ debian/patches/generate_new_puzzles.patch 2016-08-31 01:42:05 +0000
@@ -0,0 +1,38 @@
+From 95b99df63e1704cca55b13ba27f140bf4961fabb Mon Sep 17 00:00:00 2001
+From: Michael Catanzaro <mcatanzaro@gnome.org>
+Date: Mon, 11 Jul 2016 23:15:13 -0500
+Subject: qqwing-wrapper: Seed RNG
+
+This is ugly. On the master branch, we will use std::once_flag, but for
+gnome-3-20 let's avoid adding a dependency on C++ 11.
+
+https://bugzilla.gnome.org/show_bug.cgi?id=768345
+
+Bug-Debian: https://bugs.debian.org/828106
+---
+ lib/qqwing-wrapper.cpp | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/lib/qqwing-wrapper.cpp b/lib/qqwing-wrapper.cpp
+index 99c4562..dfd0ac4 100644
+--- a/lib/qqwing-wrapper.cpp
++++ b/lib/qqwing-wrapper.cpp
+@@ -41,6 +41,17 @@ int* qqwing_generate_puzzle(int difficulty)
+ const int BOARD_SIZE = 81;
+ SudokuBoard board;
+
++ // Seed RNG exactly once.
++ static GMutex mutex;
++ static bool seeded = false;
++ g_mutex_lock(&mutex);
++ if (!seeded)
++ {
++ srand(time(NULL));
++ seeded = true;
++ }
++ g_mutex_unlock(&mutex);
++
+ board.setRecordHistory(true);
+ board.setLogHistory(false);
+ board.setPrintStyle(SudokuBoard::ONE_LINE);
+
=== added file 'debian/patches/series'
--- debian/patches/series 1970-01-01 00:00:00 +0000
+++ debian/patches/series 2016-08-31 01:42:05 +0000
@@ -0,0 +1,1 @@
+generate_new_puzzles.patch
Reply to: