Files
RedBear-OS/local/recipes/system/dbus/source.tmp/test/test-privserver.c
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

174 lines
5.1 KiB
C

/*
* Copyright 2008 Red Hat, Inc.
* Copyright 2010 Ralf Habacker
* Copyright 2016-2018 Collabora Ltd.
* Copyright 2017 Endless Mobile, Inc.
* SPDX-License-Identifier: MIT
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files
* (the "Software"), to deal in the Software without restriction,
* including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <config.h>
#include <dbus/dbus-valgrind-internal.h>
#include "test-utils.h"
static void die (const char *message,
...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
static void
die (const char *message, ...)
{
va_list args;
va_start (args, message);
vfprintf (stderr, message, args);
va_end (args);
exit (1);
}
typedef struct TestServiceData TestServiceData;
struct TestServiceData
{
DBusLoop *loop;
char *private_addr;
};
static void
test_service_data_free (TestServiceData *self)
{
_dbus_loop_unref (self->loop);
dbus_free (self->private_addr);
dbus_free (self);
}
static void
new_connection_callback (DBusServer *server,
DBusConnection *new_connection,
void *data)
{
TestServiceData *testdata = data;
if (!test_connection_try_setup (testdata->loop, new_connection))
dbus_connection_close (new_connection);
}
static DBusHandlerResult
filter_session_message (DBusConnection *connection,
DBusMessage *message,
void *user_data)
{
TestServiceData *testdata = user_data;
if (dbus_message_is_method_call (message,
"org.freedesktop.DBus.TestSuite.PrivServer",
"GetPrivateAddress"))
{
DBusMessage *reply;
reply = dbus_message_new_method_return (message);
if (reply == NULL)
die ("OOM");
if (!dbus_message_append_args (reply, DBUS_TYPE_STRING,
&(testdata->private_addr),
DBUS_TYPE_INVALID))
die ("OOM");
if (!dbus_connection_send (connection, reply, NULL))
die ("Error sending message");
dbus_message_unref (reply);
return DBUS_HANDLER_RESULT_HANDLED;
}
else if (dbus_message_is_method_call (message,
"org.freedesktop.DBus.TestSuite.PrivServer",
"Quit"))
{
fprintf (stderr, "server exiting loop\n");
_dbus_loop_quit (testdata->loop);
return DBUS_HANDLER_RESULT_HANDLED;
}
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
int
main (int argc, char *argv[])
{
DBusServer *server;
DBusError error;
DBusConnection *session;
TestServiceData *testdata;
if (RUNNING_ON_VALGRIND)
{
printf ("1..0 # SKIP Not ready to run under valgrind yet\n");
return 0;
}
dbus_error_init (&error);
testdata = dbus_new (TestServiceData, 1);
testdata->loop = _dbus_loop_new ();
if (testdata->loop == NULL)
die ("out of memory");
session = dbus_bus_get (DBUS_BUS_SESSION, &error);
if (!session)
die ("couldn't access session bus");
test_connection_setup (testdata->loop, session);
dbus_bus_request_name (session, "org.freedesktop.DBus.TestSuite.PrivServer", 0, &error);
if (dbus_error_is_set (&error))
die ("couldn't request name: %s", error.message);
if (!dbus_connection_add_filter (session, filter_session_message, testdata, NULL))
die ("couldn't add filter");
server = dbus_server_listen (TEST_LISTEN, &error);
if (!server)
die ("%s", error.message);
testdata->private_addr = dbus_server_get_address (server);
fprintf (stderr, "test server listening on %s\n", testdata->private_addr);
dbus_server_set_new_connection_function (server, new_connection_callback,
testdata, NULL);
test_server_setup (testdata->loop, server);
fprintf (stderr, "server running mainloop\n");
_dbus_loop_run (testdata->loop);
fprintf (stderr, "server mainloop quit\n");
test_server_shutdown (testdata->loop, server);
test_connection_shutdown (testdata->loop, session);
dbus_connection_unref (session);
dbus_server_unref (server);
test_service_data_free (testdata);
return 0;
}