Skip to content

config-file: report a failed final close in config_save - #709

Merged
zackees merged 2 commits into
masterfrom
fix/489-config-save-close
Oct 14, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/489-config-save-close

Conversation

@zackees

@zackees zackees commented Oct 14, 2026

Copy link
Copy Markdown
Member

Fixes #489

write_to dropped the File, discarding the close error, so config_save returned CONFIG_SUCCESS and config_save_safe renamed the temp over the real config. C checks fclose. Now the file is closed once via platform::close_file (unix close(2), windows CloseHandle) and a failure returns CONFIG_ERROR, so save_safe stops before promoting.

RED (9977cd1, new tests/config_file_close.rs, interposed close returns EIO once): both tests fail with left: 0, right: -2 (CONFIG_SUCCESS vs CONFIG_ERROR); exactly one close attempt asserted.
GREEN (3448d7c): config_file, config_file_parity, config_file_close pass; ./lint ok; linux-validate run.sh OFF/ON ok, 1766 exported symbols identical; local-gate run passed (lint, rust-test, cross, tier2-linux) and stamped.

Not done: the config_save_safe: failed to write to %s log line (safe core has no logger; no behaviour change). No Tier 3 case (oracle cannot inject close failure); Tier 2 cmocka already covers /dev/full.

Fixes #489

Local-Gate: v1 tree=20613fc270f98ff1c7fb79d7e396fa3a5c15755d secs=393 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run
Ci-Attestation: {"at":1791963910,"gate":"rust/all/fmt","host":"linux-x86_64","key":"7e12cd7176843a4799c2bc69bbeee88ef664d3fc04aa507eabfb688e54942c00","lane":"lint","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":30,"stamp":"104503643cff40dceb084fdad3fe7df1","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"7e12cd7176843a4799c2bc69bbeee88ef664d3fc04aa507eabfb688e54942c00","lane":"lint","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":30,"stamp":"65ff1e5fe932e4f0e334a08b5a962e7d","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"440a1a2a3025b93f16067669ace7510cedddd62876a891ad299e872d428f2c05","lane":"rust-test","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":150,"stamp":"d02cf677a1b7201709a7ab4559971cb9","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"a5dce7ac1485152f730fab049086256df26ba5418eebe7d45b559ffb1ca1634a","lane":"cross","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":83,"stamp":"fad6c888c2bf2e923dc33ce49c2598cf","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"a5dce7ac1485152f730fab049086256df26ba5418eebe7d45b559ffb1ca1634a","lane":"cross","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":83,"stamp":"69ac89236532cda4a7585cf65741858a","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"a5dce7ac1485152f730fab049086256df26ba5418eebe7d45b559ffb1ca1634a","lane":"cross","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":83,"stamp":"8942ab47ceb45adb5fbd4df82890dff5","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"a5dce7ac1485152f730fab049086256df26ba5418eebe7d45b559ffb1ca1634a","lane":"cross","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":83,"stamp":"28a710e486b85db6daba1591ead7c2ff","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"a5dce7ac1485152f730fab049086256df26ba5418eebe7d45b559ffb1ca1634a","lane":"cross","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":83,"stamp":"befbb8e2150879a1470ae13b80ecdd0d","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"a5dce7ac1485152f730fab049086256df26ba5418eebe7d45b559ffb1ca1634a","lane":"cross","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":83,"stamp":"f09e2df712fa4d26cbf056fd99c6416b","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
Ci-Attestation: {"at":1791963910,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"8f2e51674208c951f0849fc446eaeec89de313e98cdad7a9d35f1186151ba047","lane":"tier2-linux","parents":["9977cd1051dec4863e0ee0ecf3ca990a20df54d7"],"secs":130,"stamp":"341d8016c9fcf99f51b0ffe1163af3e8","tree":"20613fc270f98ff1c7fb79d7e396fa3a5c15755d","v":1,"via":"run"}
@zackees
zackees merged commit ea3c661 into master Oct 14, 2026
21 checks passed
@zackees
zackees deleted the fix/489-config-save-close branch October 26, 2026 15:44
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/util: with ENABLE_RUST_LIBOBS=ON, config_save ignores the final close error and config_save_safe promotes the temp file

1 participant