Skip to content

libobs: Set the module type of obs_add_module_path() paths - #1906

Merged
zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/module-path-type
Oct 23, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
rdoupe:fix/module-path-type

Conversation

@rdoupe

@rdoupe rdoupe commented Oct 23, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1900

What and why

obs_add_module_path() built its struct obs_module_path on the stack and set only bin and data, so obs_find_modules2() reported an uninitialized type for every module found on those paths. The struct is now fully initialized and the type is OBS_MODULE_TYPE_UNDEFINED.

Why UNDEFINED: upstream added the type in obsproject/obs-studio@11a8445aa4 (obsproject/obs-studio#13594, "Plugin manager 1.5") and set it only on the paths the frontend plugin loaders pass to obs_load_plugins(): PLUGIN for the new locations, LEGACY_PLUGIN for the old ones. The same commit made obs_load_all_modules()/obs_load_all_modules2() no-ops, so libobs no longer loads obs_add_module_path() paths itself, and nothing in the tree calls obs_add_module_path(). The type only reaches callers of obs_find_modules2(). UNDEFINED, the zero value, is what this pre-type API actually knows. libobs's loader treats it the way it treated every module before types existed: the disabled list applies, there is no legacy-core skip, and the loaded module is neither core nor legacy, the same as a module opened directly with obs_open_module(). LEGACY_PLUGIN would add the legacy-core skip. PLUGIN behaves the same in libobs but claims a location format the caller never stated.

Upstream master has the same code and no issue or fix for it.

The test is a new case in test_core_module_load (no new executable). It fills the stack with OBS_MODULE_TYPE_CORE before calling obs_add_module_path(), so an unset type always reads as CORE and never as 0 by luck. It then checks the type reported for a disabled module and for a module named like a core module, and what obs_load_plugins() does with that type. Its code sits apart from #1894's additions to the same file, and the branch merges cleanly with #1894.

RED → GREEN

  • RED commit: 56ef85b. test_core_module_load module_path_type fails on C libobs, hybrid libobs and libobs-c-reference: both modules report type 1 (CORE), the disabled module loads, and the core-named module is marked core. The other four cases pass.
  • GREEN: test_core_module_load 5/5 on C libobs, hybrid libobs and libobs-c-reference. Full ctest 385/385 on hybrid libobs and 385/385 on libobs-c-reference, 0 skipped; exported symbols identical on all three (1766); ci/local_gate.py --lane lint passes.
  • Real app (UI, protocol output or logging changes): N/A. Nothing in the app calls obs_add_module_path(); the frontend uses typed paths.

Checklist

  • Base is master (or the description starts with a Stacked: note)
  • I claimed the issue, or no one else has an open PR for it
  • Characterization test (if the unit had none), then RED, then GREEN commits (N/A for docs-only; a focused CI fix may push RED and GREEN together)
  • User-visible change: its line in docs/features.md is added or updated (not applicable: no user-visible change)
  • (Optional) Local gate passed and the pushed head is stamped; otherwise PR CI runs the full suite
  • Warning or flag changes (-W..., ratchets): built with scripting ON (PR CI builds no OBS app: run gh workflow run ci.yml --ref <branch> for the full builds) and cross-checked with clang and MSVC
  • Intentional differences from C listed in the parity test header and rust/README.md (ports)

obs_add_module_path() fills in bin and data but never the type of its
struct obs_module_path, so obs_find_modules2() reports whatever was on
the stack. The new module_path_type case fills that stack with
OBS_MODULE_TYPE_CORE first, adds a path with a disabled module and a
module named like a core module, and checks the type reported for both
and what libobs's loader does with it: the disabled list must apply,
and the core-named module must load as neither core nor legacy.

It fails on all three libraries: both modules report type 1 (CORE),
the disabled module loads, and the core-named one is marked core.

Refs obs-rust#1900
@rdoupe
rdoupe requested a review from zackees as a code owner October 23, 2026 06:16
obs_add_module_path() set only bin and data of its struct
obs_module_path, so obs_find_modules2() reported an uninitialized
type for every module found on those paths. Initialize the whole
struct and set the type to OBS_MODULE_TYPE_UNDEFINED.

Upstream added the type in 11a8445 ("frontend: Update app module
loading behavior", obsproject/obs-studio#13594) and typed only the
paths the frontend plugin loaders pass to obs_load_plugins(): PLUGIN
for the new locations, LEGACY_PLUGIN for the old ones. The same commit
made obs_load_all_modules() and obs_load_all_modules2() no-ops, so no
libobs loader reads obs_add_module_path() paths any more; their type
only reaches callers of obs_find_modules2(). UNDEFINED, the zero value,
says what this pre-type API knows. libobs's loader treats it as it
treated every module before types: the disabled list applies, there is
no legacy-core skip, and the loaded module is neither core nor legacy,
the same as a module opened directly with obs_open_module().
LEGACY_PLUGIN would add the legacy-core skip; PLUGIN behaves the same
as UNDEFINED in libobs but claims a location format the caller never
stated.

Upstream master has the same code and no issue or fix for it.

Fixes obs-rust#1900
@rdoupe
rdoupe force-pushed the fix/module-path-type branch from d773f1a to 3305519 Compare October 23, 2026 06:16
@zackees
zackees added this pull request to the merge queue Oct 23, 2026
Merged via the queue into obs-rust:master with commit cc385d5 Oct 23, 2026
31 checks passed
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.

bug: libobs: obs_add_module_path() leaves the module path type uninitialized

2 participants