Skip to content

rust: Fix the Windows Rust tests after the base port - #74

Merged
zackees merged 2 commits into
obs-rust:masterfrom
b7216309-jpg:fix/oracle-msvc-pthreads
Oct 10, 2026
Merged

zackees merged 2 commits into
obs-rust:masterfrom
b7216309-jpg:fix/oracle-msvc-pthreads

Conversation

@b7216309-jpg

Copy link
Copy Markdown
Contributor

Description

Two fixes that make the Rust tests build and pass on Windows again after #61.

  1. rust/obs-c-oracle/build.rs: find pthread.h with MSVC. oracle/base.c includes util/threading.h, which includes <pthread.h> unconditionally:

    libobs\util\threading.h(32): fatal error C1083: Cannot open include file: 'pthread.h'
    

    Under MSVC the oracle now adds deps/w32-pthreads to its include path, the same headers libobs builds against. base.c only needs the declarations, so nothing new is linked. Non-MSVC builds are unchanged.

  2. rust/obs-util/tests/base_parity.rs: accept the MSVC dup2 return value. The capture helper asserted dup2(fd, 1) == 1. POSIX dup2 returns the new fd, but the MSVC CRT's _dup2 returns 0. The assert fired while stderr was redirected, so the capture worker exited 101 with no message, and default_handler_output_matches_oracle and default_handler_truncates_like_c failed. It now checks != -1, the failure value on both.

Motivation and Context

Since #61 merged, obs-c-oracle fails to compile on Windows, so every PR's "Rust Tests (windows)" job fails, #73 included. The same pthread.h error is behind #68's Windows failure (see #68 (comment)).

How Has This Been Tested?

Windows 11, MSVC 14.44, soldr 0.9.31:

  • Before: soldr cargo test --workspace fails building obs-c-oracle (C1083). With only fix 1, the two base_parity capture tests fail. Running the worker by hand shows it exits 101 with no output.
  • After: soldr cargo test --workspace passes all 25 test binaries. python ci/local_gate.py --lane lint passes.
  • Linux/macOS are untouched by fix 1 (MSVC-only). On those platforms fix 2 accepts the same success values as before.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

🤖 Generated with Claude Code

b7216309-jpg and others added 2 commits October 10, 2026 03:02
oracle/base.c includes util/threading.h, which includes <pthread.h>
unconditionally. MSVC has no such header, so since the base port the
oracle, and every Rust test on Windows, fails to build. libobs uses the
pthreads-win32 headers in deps/w32-pthreads; the oracle now adds the
same include directory under MSVC. base.c only needs the declarations,
so nothing new is linked.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The capture helper asserted that dup2 returns the new fd, as POSIX
specifies. The MSVC CRT's _dup2 returns 0 on success, so the assert
fired while stderr was redirected, the capture worker exited 101 with
no message, and default_handler_output_matches_oracle and
default_handler_truncates_like_c failed on Windows. Check for -1, the
failure value on both.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@zackees
zackees merged commit 5eb7f07 into obs-rust:master Oct 10, 2026
20 checks passed
zackees added a commit to nathan-v/obs-studio that referenced this pull request Oct 10, 2026
With the Windows oracle building again (obs-rust#74), input_matches_oracle found
that after a failed _fseeki64 to a negative absolute offset the MSVC CRT
reports the read-ahead position from ftell. Both sides return -1; Rust
keeps the position as glibc does. Exclude exactly those seeks on Windows
and record the difference, with the missing warning log, in rust/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zackees added a commit to nathan-v/obs-studio that referenced this pull request Oct 10, 2026
With the Windows oracle building again (obs-rust#74), input_matches_oracle found
that after a failed _fseeki64 to a negative absolute offset the MSVC CRT
reports the read-ahead position from ftell. Both sides return -1; Rust
keeps the position as glibc does. Exclude exactly those seeks on Windows
and record the difference, with the missing warning log, in rust/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=4e983ccedb846807a02077cc05a59d146f09d896 secs=32 lanes=lint:reused@5d36ef607008,rust-test:reused@3074493bd18f,tier2-linux:run
Ci-Attestation: {"at":1791595462,"gate":"rust/all/fmt","host":"linux-x86_64","key":"5d36ef60700855197b6a3487ba30d9a058cc8a7e1d0d434e02b684fbfaf1d065","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":null,"stamp":"f0f69c6e3f3d381eb23f2f9ec617a3f1","tree":"4e983ccedb846807a02077cc05a59d146f09d896","v":1,"via":"reused"}
Ci-Attestation: {"at":1791595462,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"5d36ef60700855197b6a3487ba30d9a058cc8a7e1d0d434e02b684fbfaf1d065","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":null,"stamp":"546ceb7b0caedc252147844ea5bef54b","tree":"4e983ccedb846807a02077cc05a59d146f09d896","v":1,"via":"reused"}
Ci-Attestation: {"at":1791595462,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"3074493bd18f2e4badafe79b8b74f8fdca0e7bac478903f7641664f61cd76e6d","lane":"rust-test","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":null,"stamp":"17be5dfcd2d56606c798982ecce0b6d2","tree":"4e983ccedb846807a02077cc05a59d146f09d896","v":1,"via":"reused"}
Ci-Attestation: {"at":1791595514,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"c7554166c322b61047a86b4f8eaeb3bc369de37ce34216ff49280ac88e0468a4","lane":"tier2-linux","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":32,"stamp":"0657cc12db5997b0c802c686746354d8","tree":"4e983ccedb846807a02077cc05a59d146f09d896","v":1,"via":"run"}
zackees added a commit to nathan-v/obs-studio that referenced this pull request Oct 10, 2026
With the Windows oracle building again (obs-rust#74), input_matches_oracle found
that after a failed _fseeki64 (one landing before the start of the file)
the MSVC CRT reports its read-ahead position from ftell. Both sides
return -1; Rust keeps the position as glibc does. On Windows the input
comparison checks that -1 and stops there. Record the difference, and
the missing warning log on a failed safe save, in rust/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=c3d94367712f24d7d5c91b135022e741afe3bc2f secs=59 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791595842,"gate":"rust/all/fmt","host":"linux-x86_64","key":"24f3d05bd68bdb0e09f55baba4fa0abb38fe3f0cd8f5db49fce8f71210b6a322","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":18,"stamp":"8c9adc908548ea56b0e1e9bc5c66f762","tree":"c3d94367712f24d7d5c91b135022e741afe3bc2f","v":1,"via":"run"}
Ci-Attestation: {"at":1791595842,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"24f3d05bd68bdb0e09f55baba4fa0abb38fe3f0cd8f5db49fce8f71210b6a322","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":18,"stamp":"493188cebc4077790077358770adff2b","tree":"c3d94367712f24d7d5c91b135022e741afe3bc2f","v":1,"via":"run"}
Ci-Attestation: {"at":1791595842,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"3c7953b462dbd13e4dd3585f68be4a583eab871891edd7371e7a5a251d9b8e0c","lane":"rust-test","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":5,"stamp":"265e9a7692dea01b4ed9279d527288ea","tree":"c3d94367712f24d7d5c91b135022e741afe3bc2f","v":1,"via":"run"}
Ci-Attestation: {"at":1791595842,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"ceb1ea6ce1be68be3446d707dcd81e3d58181b65f2336d78a2106977a283d72b","lane":"tier2-linux","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":36,"stamp":"92449209e9433887a7089cd5cbc44436","tree":"c3d94367712f24d7d5c91b135022e741afe3bc2f","v":1,"via":"run"}
zackees added a commit to nathan-v/obs-studio that referenced this pull request Oct 10, 2026
With the Windows oracle building again (obs-rust#74), input_matches_oracle found
that after a failed _fseeki64 (one landing before the start of the file)
the MSVC CRT reports its read-ahead position from ftell. Both sides
return -1; Rust keeps the position as glibc does. On Windows the input
comparison checks that -1 and stops there. Record the difference, and
the missing warning log on a failed safe save, in rust/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=846068ceb4ce53623644a6d6f76113789b287805 secs=46 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791596062,"gate":"rust/all/fmt","host":"linux-x86_64","key":"1ff1ac7098255d5cf3e8021be7dd3a9a061baa18ce164fef4daf3d9e5470f421","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":17,"stamp":"b971b80c320a607f9ad64b222de23c33","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
Ci-Attestation: {"at":1791596062,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"1ff1ac7098255d5cf3e8021be7dd3a9a061baa18ce164fef4daf3d9e5470f421","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":17,"stamp":"4bfd1204384cb186fbf111d942cdd04d","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
Ci-Attestation: {"at":1791596062,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"3be0c8529254be8774b9a8579f61befe128fccc5c85114b5dda01084881fab9a","lane":"rust-test","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":6,"stamp":"0d195605179bed01194869868c96fba3","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
Ci-Attestation: {"at":1791596062,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"0c2410ef76c54391fa734354f270d7525fc6a06d038e932f585464ebc89229f6","lane":"tier2-linux","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":23,"stamp":"25e6b45eab11646af495c06d5ee5df9e","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
zackees added a commit to nathan-v/obs-studio that referenced this pull request Oct 10, 2026
With the Windows oracle building again (obs-rust#74), input_matches_oracle found
that after a failed _fseeki64 (one landing before the start of the file)
the MSVC CRT reports its read-ahead position from ftell. Both sides
return -1; Rust keeps the position as glibc does. On Windows the input
comparison checks that -1 and stops there. Record the difference, and
the missing warning log on a failed safe save, in rust/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=846068ceb4ce53623644a6d6f76113789b287805 secs=46 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791596062,"gate":"rust/all/fmt","host":"linux-x86_64","key":"1ff1ac7098255d5cf3e8021be7dd3a9a061baa18ce164fef4daf3d9e5470f421","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":17,"stamp":"b971b80c320a607f9ad64b222de23c33","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
Ci-Attestation: {"at":1791596062,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"1ff1ac7098255d5cf3e8021be7dd3a9a061baa18ce164fef4daf3d9e5470f421","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":17,"stamp":"4bfd1204384cb186fbf111d942cdd04d","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
Ci-Attestation: {"at":1791596062,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"3be0c8529254be8774b9a8579f61befe128fccc5c85114b5dda01084881fab9a","lane":"rust-test","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":6,"stamp":"0d195605179bed01194869868c96fba3","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
Ci-Attestation: {"at":1791596062,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"0c2410ef76c54391fa734354f270d7525fc6a06d038e932f585464ebc89229f6","lane":"tier2-linux","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":23,"stamp":"25e6b45eab11646af495c06d5ee5df9e","tree":"846068ceb4ce53623644a6d6f76113789b287805","v":1,"via":"run"}
zackees added a commit to nathan-v/obs-studio that referenced this pull request Oct 10, 2026
With the Windows oracle building again (obs-rust#74), input_matches_oracle found
that after a failed _fseeki64 (one landing before the start of the file)
the MSVC CRT reports its read-ahead position from ftell. Both sides
return -1; Rust keeps the position as glibc does. On Windows the input
comparison checks that -1 and stops there. Record the difference, and
the missing warning log on a failed safe save, in rust/README.md.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Local-Gate: v1 tree=af6c1d467e1551e44394ac0ed933a49ee8329732 secs=32 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791596249,"gate":"rust/all/fmt","host":"linux-x86_64","key":"5e67410701c0f219a0353f5909b9e19624ab671790cfe92bd95264cef509c915","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":11,"stamp":"6701613336c9f29cbb91278474f4fcd4","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"}
Ci-Attestation: {"at":1791596249,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"5e67410701c0f219a0353f5909b9e19624ab671790cfe92bd95264cef509c915","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":11,"stamp":"2f3333d9e4d59c9c82dec892e444a51d","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"}
Ci-Attestation: {"at":1791596249,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"8b92eab9448ac56fdcfad134d08ffba37ef650d57839c60e1910570f28bbd8d5","lane":"rust-test","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":4,"stamp":"0f1e4a0b1c725df9a339a74fad37f151","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"}
Ci-Attestation: {"at":1791596249,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"8f2b1bafa720af13850ed75a3310309eeaaca37a317f94d3d3286b1217a3f817","lane":"tier2-linux","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":17,"stamp":"50cbc822a6b4e74feab4fd1ed6645af9","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"}
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.

2 participants