Repository navigation
libobs: Detect failed configuration flushes - #70
Merged
Merged
Conversation
Write configuration files to /dev/full, where small writes succeed in the stdio buffer and fail at fclose: config_save must report the error, config_save_safe must keep the original and not rotate a backup, and an empty configuration must still save directly and safely. test_config_file pinned the empty-save CONFIG_ERROR as characterized, not endorsed; it now expects CONFIG_SUCCESS. Rebased from #35 onto current master. Co-Authored-By: Mquarmoc <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
config_save ignored the fclose result, so on a full disk a small write that succeeded in the stdio buffer but failed at the flush was reported as CONFIG_SUCCESS, and config_save_safe then replaced valid settings with the truncated temporary file. Check fclose, and skip the zero-length fwrite so an empty configuration saves successfully. Fixes #35 Co-Authored-By: Mquarmoc <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=4970db921de531f5212bd9e0d6450132f9b6b46e secs=25 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791584211,"gate":"rust/all/fmt","host":"linux-x86_64","key":"2e7335148a803d5095b79d4efb03bad7fae43a5ae689c1338f447286c73b2400","lane":"lint","parents":["1c3fc331bc687f95ce6ee999f8f24a05996e8cc1"],"secs":8,"stamp":"39bb862435302fad93ce76c4a8cf0c66","tree":"4970db921de531f5212bd9e0d6450132f9b6b46e","v":1,"via":"run"} Ci-Attestation: {"at":1791584211,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"2e7335148a803d5095b79d4efb03bad7fae43a5ae689c1338f447286c73b2400","lane":"lint","parents":["1c3fc331bc687f95ce6ee999f8f24a05996e8cc1"],"secs":8,"stamp":"8f5a3c2b6987e79c87fa7910e2223302","tree":"4970db921de531f5212bd9e0d6450132f9b6b46e","v":1,"via":"run"} Ci-Attestation: {"at":1791584211,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"d47911a8b710fd21a8ea89191a368329072a1586f807be1b37e820c5d7d205c9","lane":"rust-test","parents":["1c3fc331bc687f95ce6ee999f8f24a05996e8cc1"],"secs":4,"stamp":"836ce74576f09ad5c6abe7ae85971ee2","tree":"4970db921de531f5212bd9e0d6450132f9b6b46e","v":1,"via":"run"} Ci-Attestation: {"at":1791584211,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"9132201729e7d560a3c6074671f9a9a5bcef11c3f5ccf9d12eae96aec4271191","lane":"tier2-linux","parents":["1c3fc331bc687f95ce6ee999f8f24a05996e8cc1"],"secs":13,"stamp":"86dc0ef137db936b88e2b601f1401ee1","tree":"4970db921de531f5212bd9e0d6450132f9b6b46e","v":1,"via":"run"}
This was referenced Oct 9, 2026
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.
Supersedes #35 (by @Mquarmoc), rebased onto current master as a RED → GREEN pair.
RED —
1c3fc331btest(libobs): RED config_save flush-failure testNew
test/cmocka/test_config_save.c(Linux-only, uses/dev/full). Against master, Tier 2 fails:test_save_empty_configpinned the empty-saveCONFIG_ERRORas characterized, not endorsed. As in #48, that assertion moves to the fixed behavior in the RED commit.GREEN —
eb609636alibobs: Detect failed configuration flushesfcloseresult inconfig_save.fwrite(fwrite(NULL, 0, 1, f)returns 0)../unittest: 27/27 cmocka withENABLE_RUST_LIBOBSOFF and ON, identical exported symbols. Local gate stamped.