public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Gwyn Ciesla <gwync@protonmail.com>
To: git-commits@fedoraproject.org
Subject: [rpms/astromenace] f44: Fix FTBFS
Date: Thu, 06 Aug 2026 13:51:04 GMT	[thread overview]
Message-ID: <178602426491.1.13033903556023504393.rpms-astromenace-83f54c86fd03@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/astromenace
Branch : f44
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=f44

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

                 reply	other threads:[~2026-08-06 13:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=178602426491.1.13033903556023504393.rpms-astromenace-83f54c86fd03@fedoraproject.org \
    --to=gwync@protonmail.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox