public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/astromenace] rawhide: Fix FTBFS
@ 2026-08-06 13:49 Gwyn Ciesla
  0 siblings, 0 replies; only message in thread
From: Gwyn Ciesla @ 2026-08-06 13:49 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/astromenace
Branch : rawhide
Commit : 83f54c86fd033916ac168f23c80656134210478b
Author : Gwyn Ciesla <gwync@protonmail.com>
Date   : 2026-08-06T08:49:42-05:00
Stats  : +61/-0 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/astromenace/c/83f54c86fd033916ac168f23c80656134210478b?branch=rawhide

Log:
Fix FTBFS

---
diff --git a/53.patch b/53.patch
new file mode 100644
index 0000000..84cfc31
--- /dev/null
+++ b/53.patch
@@ -0,0 +1,58 @@
+From ba9355aecb89a4386dc1af23f511f2d9f2ecafc3 Mon Sep 17 00:00:00 2001
+From: "Bernhard M. Wiedemann" <bwiedemann@suse.de>
+Date: Thu, 6 Aug 2026 12:46:37 +0200
+Subject: [PATCH] Fix hang before main() when built with GCC 16.
+
+vw_fRand() used a namespace-scope std::default_random_engine whose
+dynamic initializer seeds it from std::random_device. Static
+initializers in other translation units also call vw_fRand(), and the
+initialization order across translation units is unspecified - with
+GCC 16's LTO ordering, a consumer runs first, while the engine is
+still zero-initialized. State 0 is a fixed point of the minstd_rand0
+generator (0 * 16807 % 2147483647 == 0), std::generate_canonical()
+maps the stuck value to >= 1.0f and retries forever, so the binary
+spins in a global constructor before main() - the gamedata.vfs pack
+step during the build never terminates.
+
+Construct the engine as a function-local static instead, so it is
+seeded on first use regardless of initialization order.
+
+Fixes #52
+---
+ src/core/math/rand.cpp | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+diff --git a/src/core/math/rand.cpp b/src/core/math/rand.cpp
+index 7db8c454..59d3805b 100644
+--- a/src/core/math/rand.cpp
++++ b/src/core/math/rand.cpp
+@@ -32,8 +32,18 @@ namespace viewizard {
+ 
+ namespace {
+ 
+-std::random_device rd;
+-std::default_random_engine gen(rd());
++// Function-local static so the engine is constructed (and seeded) on first
++// use. With a namespace-scope object, another translation unit's static
++// initializer that calls vw_fRand() may run first (initialization order
++// across translation units is unspecified); the engine is then still
++// zero-initialized, and state 0 is a fixed point of the minstd generator:
++// std::generate_canonical() maps the stuck value to >= 1.0f and retries
++// forever, hanging the process before main() is reached.
++std::default_random_engine &GetRandomEngine()
++{
++    static std::default_random_engine gen{std::random_device{}()};
++    return gen;
++}
+ 
+ } // unnamed namespace
+ 
+@@ -42,7 +52,7 @@ std::default_random_engine gen(rd());
+  */
+ float vw_fRand()
+ {
+-    return std::generate_canonical<float, 10>(gen);
++    return std::generate_canonical<float, 10>(GetRandomEngine());
+ }
+ 
+ /*

diff --git a/astromenace.spec b/astromenace.spec
index 0cc17e3..648c200 100644
--- a/astromenace.spec
+++ b/astromenace.spec
@@ -8,6 +8,7 @@ URL: http://www.viewizard.com/
 Source0: https://github.com/viewizard/astromenace/archive/v%{version}/%{name}-%{version}.tar.gz
 Source1: astromenace.desktop
 Source2: astromenace.png
+Patch0:  53.patch
 ExcludeArch: ppc64 s390x
 
 BuildRequires: gcc
@@ -36,6 +37,8 @@ Go ahead and make alien aggressors regret their insolence.
 %prep
 %setup -q
 
+%patch -P 0 -p1
+
 %build
 %cmake %_vpath_srcdir -G Ninja -DDATADIR="%{_datadir}/astromenace" -DCMAKE_POLICY_VERSION_MINIMUM=3.5
 %cmake_build

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-06 13:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-06 13:49 [rpms/astromenace] rawhide: Fix FTBFS Gwyn Ciesla

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox