Repository navigation
fix(obs-util): preserve configs when opening fails - #1944
Merged
zackees merged 2 commits intoOct 23, 2026
Merged
Conversation
zackees
approved these changes
Oct 23, 2026
zackees
left a comment
Member
There was a problem hiding this comment.
Coordinator review: matches C config_open with CONFIG_OPEN_ALWAYS. A failed open retries with w+ semantics (read+write+create+truncate), so a write-only (0200) file fails the retry and keeps its bytes, returning CONFIG_FILENOTFOUND. A read error after a successful open gives an empty successful parse, as in C. Tier 1 and parity tests and the ledger line are included. LGTM.
6 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Opening an unreadable config with CONFIG_OPEN_ALWAYS preserves its contents and returns CONFIG_FILENOTFOUND, matching C. The Rust port previously retried a failed read using a write-only truncating create, so an unprivileged user opening a mode-0200 config lost all its bytes.
The fix opens first, retries only failed opens with C's read/write/create/truncate access, and reads that same handle. A read error after a successful open keeps C's empty successful parse, including config_open_defaults. BOM handling is preserved without an extra copy. Production diff: 19 added / 22 removed lines, net -3, in one Rust file. The feature ledger is updated.
Fixes #1942.
Validation on DESKTOP-3FLAOFG Ubuntu/WSL as dev, uid 1000, with
PATH=/home/dev/.local/bin:/home/dev/.soldr/bin/llvm-21.1.5-r2/bin:$PATH,SOLDR_RUSTC_WRAPPER=none, andCARGO_BUILD_JOBS=3:soldr cargo test -p obs-util --lib tests::config::config_file -- --nocapture— 68 passed, 4 failed. Separate known-byte mode-0200 files: C returned -1 and retained all 18 bytes; Rust returned 0 and retained zero bytes. Successful directory opens followed by read failure also exposed Rust -1 versus C 0.soldr cargo test -p obs-util --locked— 832 passed, 0 failed; 2 doctests passed. Includes safe-core and C-ABI/oracle regressions for byte preservation, both open modes, null output handles on failure, and defaults after read failure.soldr cargo clippy -p obs-util --all-targets --locked -- -D warnings— passed.soldr cargo fmt --all --checkandgit diff --check— passed.uv run ci/test_binary_cap.py --report— eight category binaries, no new executable.Tier 1 and Tier 3 ran locally. Existing C tests and public headers are unchanged; Tier 2 runs in PR CI (Docker/bosn are not installed on this Linux host). Tier 4 does not apply to the local config-file API. No intentional difference from C is introduced. Permission assertions report a skip only when run by a privileged user who can read mode-0200 files; they executed as unprivileged dev in the recorded runs.
The other PC became read-only after validation, so the tested GREEN changes were committed and pushed from the isolated Windows checkout using its existing Git credentials. The parent remote checkout was not changed.
Ready for review; PR CI/review results remain pending. This worker will not merge or monitor the PR.