From fd8ed265558c82e6c24762b0453de8b0962665ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 21 Sep 2026 11:27:47 +0200 Subject: [PATCH 1/3] ReleaseChannel: parse non-numeric OS versions on Windows Server QSysInfo::productVersion() returns "Server 2022" on Windows Server, so splitting on '.' and calling toInt() made the version unparseable and disabled the in-client updater there. Extract the first numeric token instead; Server 2022 becomes 2022 and matches the Win10 assets. --- .../network/update/client/release_channel.cpp | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/cockatrice/src/client/network/update/client/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp index b760c021c..22fd0e0d4 100644 --- a/cockatrice/src/client/network/update/client/release_channel.cpp +++ b/cockatrice/src/client/network/update/client/release_channel.cpp @@ -27,6 +27,27 @@ #define GIT_SHORT_HASH_LEN 7 +namespace +{ + +// QSysInfo::productVersion() is not guaranteed to start with a number, e.g. it returns +// "Server 2022" on Windows Server. Use the first numeric token as the major host version. +std::optional getProductVersionMajor() +{ + const QString versionString = QSysInfo::productVersion(); + bool ok = false; + static const QRegularExpression firstNumber(R"((\d+))"); + const auto match = firstNumber.match(versionString); + const int version = match.hasMatch() ? match.captured(1).toInt(&ok) : 0; + if (!ok) { + qCWarning(ReleaseChannelLog) << "Unable to determine OS version from" << versionString; + return std::nullopt; + } + return version; +} + +} // namespace + ReleaseChannel::ReleaseChannel() : netMan(new QNetworkAccessManager(this)), response(nullptr), lastRelease(nullptr) { } @@ -49,16 +70,7 @@ std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &f { const QRegularExpression *regex = nullptr; - static const std::optional systemVersion = [] { - bool ok = false; - const QString versionString = QSysInfo::productVersion(); - const int version = versionString.split('.').first().toInt(&ok); - if (!ok) { - qCWarning(ReleaseChannelLog) << "Unable to determine OS version from" << versionString; - return std::optional(); - } - return std::optional{version}; - }(); + static const std::optional systemVersion = getProductVersionMajor(); if (!systemVersion) { return std::nullopt; From 709d145422276f8453a3dab10af12bf8792787cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 21 Sep 2026 11:30:07 +0200 Subject: [PATCH 2/3] ReleaseChannel: don't offer 64-bit assets on 32-bit Windows The old downloadMatchesCurrentOS() had an explicit 32-bit branch that only accepted "32bit" assets. Restore that guard: 32-bit Windows builds return no match instead of being offered the 64-bit Win10 installer that won't run. --- .../src/client/network/update/client/release_channel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cockatrice/src/client/network/update/client/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp index 22fd0e0d4..3087c298a 100644 --- a/cockatrice/src/client/network/update/client/release_channel.cpp +++ b/cockatrice/src/client/network/update/client/release_channel.cpp @@ -68,6 +68,12 @@ void ReleaseChannel::checkForUpdates() // Find assets compatible with host platform (Linux is not supported by in-client updater) std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &fileName) { +#if defined(Q_OS_WIN) && Q_PROCESSOR_WORDSIZE == 4 + // The published Windows assets are 64-bit only + Q_UNUSED(fileName); + return std::nullopt; +#endif + const QRegularExpression *regex = nullptr; static const std::optional systemVersion = getProductVersionMajor(); From 45662ac4e2a79bece6ef26b12eaad548b192eed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20Br=C3=BCbach?= Date: Mon, 21 Sep 2026 11:34:52 +0200 Subject: [PATCH 3/3] ReleaseChannel: only query the OS version on updater platforms The in-client updater only ships assets for macOS and Windows, but the host system version was still being resolved on every platform, including Linux where it is never used. Compute it only under the Q_OS_MACOS / Q_OS_WIN guards. --- .../client/network/update/client/release_channel.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/cockatrice/src/client/network/update/client/release_channel.cpp b/cockatrice/src/client/network/update/client/release_channel.cpp index 3087c298a..f401dfd00 100644 --- a/cockatrice/src/client/network/update/client/release_channel.cpp +++ b/cockatrice/src/client/network/update/client/release_channel.cpp @@ -30,6 +30,7 @@ namespace { +#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) // QSysInfo::productVersion() is not guaranteed to start with a number, e.g. it returns // "Server 2022" on Windows Server. Use the first numeric token as the major host version. std::optional getProductVersionMajor() @@ -45,6 +46,7 @@ std::optional getProductVersionMajor() } return version; } +#endif } // namespace @@ -76,7 +78,13 @@ std::optional ReleaseChannel::getTargetVersionForCurrentOS(const QString &f const QRegularExpression *regex = nullptr; - static const std::optional systemVersion = getProductVersionMajor(); + // Only platforms shipping updater assets (macOS, Windows) need the host version + static const std::optional systemVersion = +#if defined(Q_OS_MACOS) || defined(Q_OS_WIN) + getProductVersionMajor(); +#else + std::nullopt; +#endif if (!systemVersion) { return std::nullopt;