Skip to content

libobs: Detect failed configuration flushes - #70

Merged
zackees merged 2 commits into
masterfrom
fix/config-save-flush
Oct 10, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/config-save-flush

Conversation

@zackees

@zackees zackees commented Oct 9, 2026

Copy link
Copy Markdown
Member

Supersedes #35 (by @Mquarmoc), rebased onto current master as a RED → GREEN pair.

RED — 1c3fc331b test(libobs): RED config_save flush-failure test

New test/cmocka/test_config_save.c (Linux-only, uses /dev/full). Against master, Tier 2 fails:

config_save_reports_flush_failure    0 != -2   (flush error reported as success)
config_save_safe_preserves_original  0 != -2   (original replaced by truncated temp)
config_save_empty_succeeds           -2 != 0   (empty config cannot be saved)
test_config_file: test_save_empty_config

test_save_empty_config pinned the empty-save CONFIG_ERROR as characterized, not endorsed. As in #48, that assertion moves to the fixed behavior in the RED commit.

GREEN — eb609636a libobs: Detect failed configuration flushes

  • Check the fclose result in config_save.
  • Skip the zero-length fwrite (fwrite(NULL, 0, 1, f) returns 0).

./unittest: 27/27 cmocka with ENABLE_RUST_LIBOBS OFF and ON, identical exported symbols. Local gate stamped.

zackees and others added 2 commits October 9, 2026 15:15
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"}
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.

1 participant