Files
RedBear-OS/local/recipes/qt/qtbase/source/tests/shared/localechange.h
T
vasilito f31522130f fix: comprehensive boot warnings and exceptions — fixable silenced, unfixable diagnosed
Build system (5 gaps hardened):
- COOKBOOK_OFFLINE defaults to true (fork-mode)
- normalize_patch handles diff -ruN format
- New 'repo validate-patches' command (25/25 relibc patches)
- 14 patched Qt/Wayland/display recipes added to protected list
- relibc archive regenerated with current patch chain

Boot fixes (fixable):
- Full ISO EFI partition: 16 MiB → 1 MiB (matches mini, BIOS hardcoded 2 MiB offset)
- D-Bus system bus: absolute /usr/bin/dbus-daemon path (was skipped)
- redbear-sessiond: absolute /usr/bin/redbear-sessiond path (was skipped)
- daemon framework: silenced spurious INIT_NOTIFY warnings for oneshot_async services (P0-daemon-silence-init-notify.patch)
- udev-shim: demoted INIT_NOTIFY warning to INFO (expected for oneshot_async)
- relibc: comprehensive named semaphores (sem_open/close/unlink) replacing upstream todo!() stubs
- greeterd: Wayland socket timeout 15s → 30s (compositor DRM wait)
- greeter-ui: built and linked (header guard unification, sem_compat stubs removed)
- mc: un-ignored in both configs, fixed glib/libiconv/pcre2 transitive deps
- greeter config: removed stale keymapd dependency from display/greeter services
- prefix toolchain: relibc headers synced, _RELIBC_STDLIB_H guard unified

Unfixable (diagnosed, upstream):
- i2c-hidd: abort on no-I2C-hardware (QEMU) — process::exit → relibc abort
- kded6/greeter-ui: page fault 0x8 — Qt library null deref
- Thread panics fd != -1 — Rust std library on Redox
- DHCP timeout / eth0 MAC — QEMU user-mode networking
- hwrngd/thermald — no hardware RNG/thermal in VM
- live preload allocation — BIOS memory fragmentation, continues on demand
2026-05-05 20:20:37 +01:00

89 lines
2.7 KiB
C++

// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
#ifndef QT_TESTS_SHARED_LOCALE_CHANGE_H
#define QT_TESTS_SHARED_LOCALE_CHANGE_H
#include <qglobal.h>
#include <QtCore/QByteArray>
#include <QtCore/QLocale>
#include <private/qlocale_p.h>
#include <locale.h>
namespace QTestLocaleChange {
inline QLocale resetSystemLocale()
{
#ifndef QT_NO_SYSTEMLOCALE
{ // Transient instance marks system locale data as stale:
QSystemLocale dummy;
} // Now we can reinitialize:
#endif
return QLocale::system();
}
class TransientLocale
{
const int m_category;
const QByteArray m_prior;
const bool m_didSet;
#if !defined(QT_NO_SYSTEMLOCALE) && defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
#define TRANSIENT_ENV
// Unix system locale consults environment variables, so we need to set
// the appropriate one, too.
const QByteArray m_envVar, m_envPrior;
const bool m_envSet;
static QByteArray categoryToEnv(int category)
{
switch (category) {
#define CASE(cat) case cat: return #cat
CASE(LC_ALL); CASE(LC_NUMERIC); CASE(LC_TIME); CASE(LC_MONETARY);
CASE(LC_MESSAGES); CASE(LC_COLLATE);
#ifdef LC_MEASUREMENT
CASE(LC_MEASUREMENT);
#endif
#undef CASE
// Nothing in our code pays attention to any other LC_*
default:
Q_UNREACHABLE();
qFatal("You need to add a case for this category");
}
}
#endif // TRANSIENT_ENV
public:
TransientLocale(int category, const char *locale)
: m_category(category),
m_prior(setlocale(category, nullptr)),
// That return value may be stomped by this later call, so we copy
// it to a QByteArray for safe keeping.
m_didSet(setlocale(category, locale) != nullptr)
#ifdef TRANSIENT_ENV
, m_envVar(categoryToEnv(category)),
m_envPrior(qgetenv(m_envVar.constData())),
m_envSet(qputenv(m_envVar.constData(), locale))
#endif
{
resetSystemLocale();
}
~TransientLocale()
{
#ifdef TRANSIENT_ENV
if (m_envSet) {
if (m_envPrior.isEmpty())
qunsetenv(m_envVar.constData());
else
qputenv(m_envVar.constData(), m_envPrior);
}
#endif
if (m_prior.size())
setlocale(m_category, m_prior.constData());
resetSystemLocale();
}
#undef TRANSIENT_ENV
bool isValid() const { return m_didSet; }
};
}
#endif // QT_TESTS_SHARED_LOCALE_CHANGE_H