Skip to content

rust: Port session D-Bus sleep inhibitor to obs-util - #1577

Merged
zackees merged 4 commits into
masterfrom
port/platform-nix-dbus
Oct 21, 2026
Merged

zackees merged 4 commits into
masterfrom
port/platform-nix-dbus

Conversation

@zackees

@zackees zackees commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Refs #1576

Port the Linux and FreeBSD session D-Bus sleep inhibitor from libobs/util/platform-nix-dbus.c.h into obs-util. The existing libobs C ABI and GIO feature gate remain intact. The C implementation is compiled as a deterministic Tier 3 oracle; the production Rust shim calls GIO directly.

RED: fb3ffbbef — five new Tier 1 cases fail at the safe Rust stubs.
GREEN: 598a03b2a — safe state machine, C ABI shim, Tier 3 oracle tests, build group wiring and docs.

Verification:

  • soldr cargo test -p obs-util --lib --features gio platform::dbus_inhibit: five Tier 1 and two Tier 3 cases pass. Reversing service order made Tier 3 fail, then restoring it passed.
  • Existing platform::nix_inhibit_parity tests pass with and without GIO.
  • ./lint --fix, uv run ci/test_ported_sources.py, uv run ci/test_build_groups.py, and uv run ci/test_registration.py pass.
  • cmake/cross/docker.sh win-x64 mac-arm64 passes both full cross builds. The local unchanged C suite passed all 337 OFF cases; the ON focused D-Bus case passed against libobs-with-rust. PR Tier 2 remains the full merge gate.
  • Unchanged C test_inhibit_sleep_dbus passes against both original and Rust libobs. The two libraries export identical dynamic symbols (1766).

Intentional implementation details: the C ABI's opaque inhibitor handle owns a Rust Box rather than a C allocation. A null reason pointer becomes an empty string for the GIO call; the deterministic differential oracle covers non-null reasons.

CI fix: Fast Gate initially failed because its runner lacked GIO development files. Commit ded2ee62f installs libglib2.0-dev in the existing package setup step, restoring the explicit GIO dependency check. The local ./lint passes. Remote RED evidence is in the first two CI runs of this PR; the new CI run verifies GREEN.

@zackees

zackees commented Oct 21, 2026

Copy link
Copy Markdown
Member Author

Windows Tier 2 currently fails while linking test_output_delay_e2e.c from newly merged #1578: LNK2019 cm_print_error. This branch predates that test and does not change it. Tracking the baseline blocker in #1580; I will keep this PR draft until the required CI gate passes.

@zackees
zackees force-pushed the port/platform-nix-dbus branch 3 times, most recently from ded2ee6 to 497b5f6 Compare October 21, 2026 17:22
@zackees
zackees marked this pull request as ready for review October 21, 2026 17:39
@zackees
zackees added this pull request to the merge queue Oct 21, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 21, 2026
@zackees
zackees force-pushed the port/platform-nix-dbus branch from 497b5f6 to fd3183e Compare October 21, 2026 18:12
@zackees
zackees enabled auto-merge October 21, 2026 18:13
@zackees
zackees force-pushed the port/platform-nix-dbus branch from fd3183e to 90987d5 Compare October 21, 2026 20:41
target_sources(libobs ...) compiled util/platform-nix-dbus.c into the
hybrid libobs next to the Rust dbus_* symbols, failing the link. Use
obs_libobs_add_c_sources like the other ported source sets.
@zackees
zackees added this pull request to the merge queue Oct 21, 2026
Merged via the queue into master with commit 02428da Oct 21, 2026
25 of 27 checks passed
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 22, 2026
* test: Check obs-util's gio-2.0 probe on cross targets

Since the session D-Bus inhibitor port (obs-rust#1577), obs-util's build script
requires gio-2.0 through pkg-config whenever the `gio` feature is on,
also for a cross target. libobs-rust turns that feature on by default,
so the release gate's `cross-release` lane, which lints the workspace
for aarch64-unknown-linux-gnu, now fails: soldr's aarch64 sysroot has
no GIO.

Move the probe decision unchanged into build/gio.rs so it can be unit
tested, and add Tier 1 cases: a native Linux build still requires GIO,
a cross build must not. The cross case fails.

Refs obs-rust#1688

* rust: Let obs-util's gio-2.0 probe warn on cross targets

The session D-Bus inhibitor port (obs-rust#1577) made obs-util's build script
probe gio-2.0 through pkg-config and panic without it. The Rust
inhibitor declares GIO's functions itself, so the probe only adds link
flags. That is needed natively, where Cargo links the test binaries
against GIO, but not for a cross target: the cross gates only lint or
build the staticlib, and CMake links hybrid libobs with gio::gio
itself. soldr's aarch64 Linux sysroot has no GIO, so the release
gate's cross-release lane failed at obs-util's build script.

A cross build now still probes gio-2.0 and uses it when found, and
otherwise prints a Cargo warning instead of failing. A native build is
unchanged: it requires GIO.

Fixes obs-rust#1688
@nathan-v nathan-v mentioned this pull request Oct 22, 2026
6 of 7 tasks
@zackees
zackees deleted the port/platform-nix-dbus branch October 26, 2026 15:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant