Files
RedBear-OS/local/recipes/system/dbus/source/test/name-test/test-pending-call-disconnected.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

126 lines
3.8 KiB
C

/*
* Copyright © 2006 Red Hat Inc.
* Copyright © 2017 Shin-ichi MORITA <shin1morita@gmail.com>
* 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.
*/
/**
* Test to make sure that pending calls unref error messages
* when blocked after disconnected.
**/
#include <config.h>
#include <dbus/dbus.h>
#include <dbus/dbus-sysdeps.h>
#include <dbus/dbus-valgrind-internal.h>
#include <stdio.h>
#include <stdlib.h>
static size_t count = 0;
static void
free_data (void *data)
{
--count;
printf ("# Freed: %s\n", (const char*)data);
}
/* This test outputs TAP syntax: http://testanything.org/ */
int
main (int argc, char *argv[])
{
dbus_int32_t slot_connection = -1;
dbus_int32_t slot_message = -1;
dbus_int32_t slot_pending = -1;
DBusError error;
DBusConnection *conn;
DBusMessage *method;
DBusPendingCall *pending;
DBusMessage *reply;
if (RUNNING_ON_VALGRIND)
{
printf ("1..0 # SKIP Not ready to run under valgrind yet\n");
return 0;
}
printf ("# Testing pending call error\n");
dbus_connection_allocate_data_slot (&slot_connection);
dbus_message_allocate_data_slot (&slot_message);
dbus_pending_call_allocate_data_slot (&slot_pending);
dbus_error_init (&error);
conn = dbus_bus_get_private (DBUS_BUS_SESSION, &error);
dbus_connection_set_data (conn, slot_connection, (void*)"connection", free_data);
++count;
dbus_connection_set_exit_on_disconnect (conn, FALSE);
method = dbus_message_new_method_call ("org.freedesktop.TestSuiteEchoService",
"/org/freedesktop/TestSuite",
"org.freedesktop.TestSuite",
"Exit");
dbus_message_set_data (method, slot_message, (void*)"method", free_data);
++count;
dbus_connection_send_with_reply (conn, method, &pending, -1);
dbus_message_unref (method);
dbus_pending_call_set_data (pending, slot_pending, (void*)"pending", free_data);
++count;
dbus_connection_close (conn);
dbus_pending_call_block (pending);
reply = dbus_pending_call_steal_reply (pending);
dbus_pending_call_unref (pending);
if (reply == NULL)
{
printf ("Bail out! Reply is NULL ***\n");
exit (1);
}
dbus_message_set_data (reply, slot_message, (void*)"reply", free_data);
++count;
if (dbus_message_get_type (reply) != DBUS_MESSAGE_TYPE_ERROR)
{
printf ("Bail out! Reply is not error ***\n");
exit (1);
}
dbus_message_unref (reply);
dbus_connection_unref (conn);
dbus_connection_free_data_slot (&slot_connection);
dbus_message_free_data_slot (&slot_message);
dbus_pending_call_free_data_slot (&slot_pending);
if (count != 0)
{
printf ("not ok # Not all refs were unrefed ***\n");
exit (1);
}
else
{
printf ("ok\n# Testing completed\n1..1\n");
exit (0);
}
}