public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
To: git-commits@fedoraproject.org
Subject: [rpms/ddnet] exclude-empty-files: Fix build
Date: Thu, 03 Sep 2026 00:10:23 GMT	[thread overview]
Message-ID: <178839422383.1.8870715291380575248.rpms-ddnet-e3f33e08ee8b@fedoraproject.org> (raw)

A new commit has been pushed.

Repo   : rpms/ddnet
Branch : exclude-empty-files
Commit : e3f33e08ee8baabb3b318c531ade2fcda9dd7b56
Author : Sérgio M. Basto <sergio@serjux.com>
Date   : 2024-06-23T19:25:58+01:00
Stats  : +172/-0 in 3 file(s)
URL    : https://src.fedoraproject.org/rpms/ddnet/c/e3f33e08ee8baabb3b318c531ade2fcda9dd7b56?branch=exclude-empty-files

Log:
Fix build

---
diff --git a/0003-format-security.patch b/0003-format-security.patch
new file mode 100644
index 0000000..1ef8180
--- /dev/null
+++ b/0003-format-security.patch
@@ -0,0 +1,107 @@
+--- ./src/engine/client/client.cpp.orig	2024-06-22 17:11:40.117804025 +0100
++++ ./src/engine/client/client.cpp	2024-06-22 17:11:46.890791852 +0100
+@@ -3124,7 +3124,7 @@ bool CClient::InitNetworkClient(char *pE
+ 					if(g_Config.m_Bindaddr[0])
+ 						str_format(pError, ErrorSize, "Could not open the network client, try changing or unsetting the bindaddr '%s'.", g_Config.m_Bindaddr);
+ 					else
+-						str_format(pError, ErrorSize, "Could not open the network client.");
++						str_format(pError, ErrorSize, "Could not open the network client.", "");
+ 					return false;
+ 				}
+ 			}
+--- ./src/game/client/components/menus_settings.cpp.orig	2024-06-14 05:30:46.000000000 +0100
++++ ./src/game/client/components/menus_settings.cpp	2024-06-22 21:20:46.054704973 +0100
+@@ -3418,15 +3418,15 @@ void CMenus::RenderSettingsDDNet(CUIRect
+ 			}
+ 		}
+ 		else if(State >= IUpdater::GETTING_MANIFEST && State < IUpdater::NEED_RESTART)
+-			str_format(aBuf, sizeof(aBuf), Localize("Updating…"));
++			str_format(aBuf, sizeof(aBuf), Localize("Updating…"), "");
+ 		else if(State == IUpdater::NEED_RESTART)
+ 		{
+-			str_format(aBuf, sizeof(aBuf), Localize("DDNet Client updated!"));
++			str_format(aBuf, sizeof(aBuf), Localize("DDNet Client updated!"), "");
+ 			m_NeedRestartUpdate = true;
+ 		}
+ 		else
+ 		{
+-			str_format(aBuf, sizeof(aBuf), Localize("No updates available"));
++			str_format(aBuf, sizeof(aBuf), Localize("No updates available"), "");
+ 			UpdaterRect.VSplitLeft(TextRender()->TextWidth(14.0f, aBuf, -1, -1.0f) + 10.0f, &UpdaterRect, &Button);
+ 			Button.VSplitLeft(100.0f, &Button, nullptr);
+ 			static CButtonContainer s_ButtonUpdate;
+--- ./src/game/editor/editor_actions.cpp.orig	2024-06-22 17:40:28.775696370 +0100
++++ ./src/game/editor/editor_actions.cpp	2024-06-22 21:23:47.440395282 +0100
+@@ -320,7 +320,7 @@ void CEditorActionDeleteQuad::Redo()
+ CEditorActionEditQuadPoint::CEditorActionEditQuadPoint(CEditor *pEditor, int GroupIndex, int LayerIndex, int QuadIndex, std::vector<CPoint> const &vPreviousPoints, std::vector<CPoint> const &vCurrentPoints) :
+ 	CEditorActionLayerBase(pEditor, GroupIndex, LayerIndex), m_QuadIndex(QuadIndex), m_vPreviousPoints(vPreviousPoints), m_vCurrentPoints(vCurrentPoints)
+ {
+-	str_format(m_aDisplayText, sizeof(m_aDisplayText), "Edit quad points");
++	str_format(m_aDisplayText, sizeof(m_aDisplayText), "Edit quad points", "");
+ }
+ 
+ void CEditorActionEditQuadPoint::Undo()
+@@ -628,7 +628,7 @@ CEditorActionGroup::CEditorActionGroup(C
+ 	if(m_Delete)
+ 		str_format(m_aDisplayText, sizeof(m_aDisplayText), "Delete group %d", m_GroupIndex);
+ 	else
+-		str_format(m_aDisplayText, sizeof(m_aDisplayText), "New group");
++		str_format(m_aDisplayText, sizeof(m_aDisplayText), "New group", "");
+ }
+ 
+ void CEditorActionGroup::Undo()
+@@ -1198,7 +1198,7 @@ CEditorActionTileArt::CEditorActionTileA
+ 	IEditorAction(pEditor), m_PreviousImageCount(PreviousImageCount), m_vImageIndexMap(vImageIndexMap)
+ {
+ 	str_copy(m_aTileArtFile, pTileArtFile);
+-	str_format(m_aDisplayText, sizeof(m_aDisplayText), "Tile art");
++	str_format(m_aDisplayText, sizeof(m_aDisplayText), "Tile art", "");
+ }
+ 
+ void CEditorActionTileArt::Undo()
+@@ -1266,7 +1266,7 @@ CEditorCommandAction::CEditorCommandActi
+ 	switch(m_Type)
+ 	{
+ 	case EType::ADD:
+-		str_format(m_aDisplayText, sizeof(m_aDisplayText), "Add command");
++		str_format(m_aDisplayText, sizeof(m_aDisplayText), "Add command", "");
+ 		break;
+ 	case EType::EDIT:
+ 		str_format(m_aDisplayText, sizeof(m_aDisplayText), "Edit command %d", m_CommandIndex);
+--- ./src/game/client/components/menus_start.cpp.orig	2024-06-22 21:28:03.483958586 +0100
++++ ./src/game/client/components/menus_start.cpp	2024-06-22 21:29:54.126769996 +0100
+@@ -225,12 +225,12 @@ void CMenus::RenderStartMenu(CUIRect Mai
+ 	}
+ 	else if(State == IUpdater::FAIL)
+ 	{
+-		str_format(aBuf, sizeof(aBuf), Localize("Update failed! Check log…"));
++		str_format(aBuf, sizeof(aBuf), Localize("Update failed! Check log…"), "");
+ 		TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
+ 	}
+ 	else if(State == IUpdater::NEED_RESTART)
+ 	{
+-		str_format(aBuf, sizeof(aBuf), Localize("DDNet Client updated!"));
++		str_format(aBuf, sizeof(aBuf), Localize("DDNet Client updated!"), "");
+ 		TextRender()->TextColor(1.0f, 0.4f, 0.4f, 1.0f);
+ 	}
+ 	Ui()->DoLabel(&VersionUpdate, aBuf, 14.0f, TEXTALIGN_ML);
+--- ./src/game/client/components/hud.cpp.orig	2024-06-22 23:00:01.687286685 +0100
++++ ./src/game/client/components/hud.cpp	2024-06-22 23:02:23.625031148 +0100
+@@ -1620,7 +1620,7 @@ void CHud::RenderRecord()
+ 	if(m_ServerRecord > 0.0f)
+ 	{
+ 		char aBuf[64];
+-		str_format(aBuf, sizeof(aBuf), Localize("Server best:"));
++		str_format(aBuf, sizeof(aBuf), Localize("Server best:"), "");
+ 		TextRender()->Text(5, 75, 6, aBuf, -1.0f);
+ 		char aTime[32];
+ 		str_time_float(m_ServerRecord, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));
+@@ -1632,7 +1632,7 @@ void CHud::RenderRecord()
+ 	if(PlayerRecord > 0.0f)
+ 	{
+ 		char aBuf[64];
+-		str_format(aBuf, sizeof(aBuf), Localize("Personal best:"));
++		str_format(aBuf, sizeof(aBuf), Localize("Personal best:"), "");
+ 		TextRender()->Text(5, 82, 6, aBuf, -1.0f);
+ 		char aTime[32];
+ 		str_time_float(PlayerRecord, TIME_HOURS_CENTISECS, aTime, sizeof(aTime));

diff --git a/ddnet.spec b/ddnet.spec
index 27f55e5..6337beb 100644
--- a/ddnet.spec
+++ b/ddnet.spec
@@ -39,6 +39,8 @@ Patch1:         0001-Disabled-network-lookup-test.patch
 
 # Unbundle md5 and json-parser
 Patch2:         0002-Unbundle-md5_and_json-parser.patch
+Patch3:         0003-format-security.patch
+Patch4:         eab49abce2f67d8578bc87af5f7a4a04a7829449.patch
 
 BuildRequires:  desktop-file-utils
 BuildRequires:  libappstream-glib

diff --git a/eab49abce2f67d8578bc87af5f7a4a04a7829449.patch b/eab49abce2f67d8578bc87af5f7a4a04a7829449.patch
new file mode 100644
index 0000000..31b1906
--- /dev/null
+++ b/eab49abce2f67d8578bc87af5f7a4a04a7829449.patch
@@ -0,0 +1,63 @@
+From 71b3c8a35bcdeb9287df9c7e1801c2021daf5ddb Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Robert=20M=C3=BCller?= <robytemueller@gmail.com>
+Date: Tue, 11 Jun 2024 22:11:50 +0200
+Subject: [PATCH] Force default `char` to be `signed` on all architectures
+
+We assume that `char` is `signed` in various places in the code. In particular, the `Str.StrToInts` test will fail when `char` is not `signed` and names containing special characters will be displayed incorrectly on servers.
+
+Therefore, the compiler flag `-fsigned-char` is set unconditionally instead of only for ARM and ARM64, as we expect `char` to be `signed` on all architectures.
+
+A static assertion is added to ensure at compile time that `char` is `signed` independently from the flag added in `CMakeLists.txt`.
+
+This is necessary at least for ARM, ARM64, PPC, PPC64, and PPC64LE. According to some sources, `char` may also be `unsigned` by default when compiling for Android, although this could not be confirmed with the current Android NDK using Clang.
+
+For the PowerPC architectures, Compiler Explorer can be used to confirm that `char` is not `signed` by default by checking whether the static assertion compiles (see https://godbolt.org/z/9rn5Mrf59) and that the assembly is different with the `-fsigned-char` flag (see https://godbolt.org/z/138zTj3Wa).
+
+Closes #8386.
+---
+ CMakeLists.txt        | 9 ++++-----
+ src/game/gamecore.cpp | 4 ++++
+ 2 files changed, 8 insertions(+), 5 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index a10762c3239..71e625e5421 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -291,11 +291,10 @@ if(NOT MSVC AND NOT HAIKU)
+     add_cxx_compiler_flag_if_supported(OUR_FLAGS -ffloat-store)
+   endif()
+ 
+-  # This is needed to get the server to correctly display special characters
+-  # on ARM systems.
+-  if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
+-    add_cxx_compiler_flag_if_supported(OUR_FLAGS -fsigned-char)
+-  endif()
++  # We assume that char is signed in various places in the code. In particular,
++  # the Str.StrToInts test will fail when char is not signed and names containing
++  # special characters will be displayed incorrectly on servers.
++  add_cxx_compiler_flag_if_supported(OUR_FLAGS -fsigned-char)
+ 
+   # Don't insert timestamps into PEs to keep the build reproducible.
+   if(TARGET_OS STREQUAL "windows")
+diff --git a/src/game/gamecore.cpp b/src/game/gamecore.cpp
+index fad18b7ac32..0f37382b0f9 100644
+--- a/src/game/gamecore.cpp
++++ b/src/game/gamecore.cpp
+@@ -9,6 +9,8 @@
+ #include <base/system.h>
+ #include <engine/shared/config.h>
+ 
++#include <limits>
++
+ const char *CTuningParams::ms_apNames[] =
+ 	{
+ #define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) #ScriptName,
+@@ -63,6 +65,8 @@ float CTuningParams::GetWeaponFireDelay(int Weapon) const
+ 	}
+ }
+ 
++static_assert(std::numeric_limits<char>::is_signed, "char must be signed for StrToInts to work correctly");
++
+ void StrToInts(int *pInts, size_t NumInts, const char *pStr)
+ {
+ 	dbg_assert(NumInts > 0, "StrToInts: NumInts invalid");

                 reply	other threads:[~2026-09-03  0:10 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=178839422383.1.8870715291380575248.rpms-ddnet-e3f33e08ee8b@fedoraproject.org \
    --to=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