You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: libobs/util: with ENABLE_RUST_LIBOBS=ON, os_process_pipe_create drops the inherited standard stream on POSIX #485
With ENABLE_RUST_LIBOBS=ON, os_process_pipe_create and os_process_pipe_create2 replace the child's unpiped standard stream with /dev/null. The C implementation leaves it as the parent's own descriptor. A helper started in read mode that reads stdin, or in write mode that prints to stdout, behaves differently depending on the build flag. Severity: low to medium. It only affects children that use the unpiped stream, but it is a silent behaviour change from the C reference.
Steps / trigger
On macOS or Linux, with the parent's stdin and stdout redirected to files or pipes:
os_process_pipe_create("cat", "r") and read from the pipe. Stdin is not piped in read mode, so cat should read the parent's stdin.
os_process_pipe_create("echo OUT", "w") and close the pipe. Stdout is not piped in write mode, so OUT should reach the parent's stdout.
OFF delivers the data in both cases. ON delivers nothing: the child sees EOF on stdin, and its stdout is discarded. os_process_pipe_create2 behaves the same way.
Cause
Line numbers are against current master.
C reference, libobs/util/pipe-posix.c:76-88: in read mode only stdout is redirected, in write mode only stdin. The other stream is untouched, so posix_spawn lets the child inherit it. Stderr is always piped (:90-94).
rust/obs-util/src/platform/unix/pipe.rs:37 and :39: the Rust spawn sets Stdio::null() for the unpiped stream (stdin in read mode, stdout in write mode). The comment at :41 only mentions stderr.
Proposed fix
In spawn, pipe only the stream the mode needs (stdout in read mode, stdin in write mode) and leave the other at Command's default, which inherits the parent's descriptor. Stderr stays piped in both modes. C needs no change. The regression test is a POSIX cmocka test with four cases (create and create2, read and write mode) that passes today with OFF and fails with ON, then passes with both after the fix.
I'd like to work on this; a fix with a regression test is ready.
@chriscoveries go ahead: please open the PR with the RED test commit first, then the fix (one PR per issue, targeting master). Marking it claimed for you so nobody duplicates it.
Releasing this one. We're backed up on CI and won't get it landed soon, so anyone who wants it is welcome to take it.
If it helps, our RED test and fix are on the fork branch fix/pipe-stdio-inherit-parity. They passed review on our side but haven't been through CI, so reuse them or start fresh, whichever you prefer.
Activity
zackees commentedon Oct 13, 2026
@chriscoveries go ahead: please open the PR with the RED test commit first, then the fix (one PR per issue, targeting master). Marking it claimed for you so nobody duplicates it.
chriscoveries commentedon Oct 14, 2026
Releasing this one. We're backed up on CI and won't get it landed soon, so anyone who wants it is welcome to take it.
If it helps, our RED test and fix are on the fork branch
fix/pipe-stdio-inherit-parity. They passed review on our side but haven't been through CI, so reuse them or start fresh, whichever you prefer.obs-util: Keep inherited stdin/stdout in Rust os_process_pipe (#485) (#…