Repository navigation
fix(obs-util): config_file duplicate section/key lookup follows uthash (#681) - #726
Merged
Merged
Conversation
) Sections and items now live in a UtList that reproduces uthash 2.3.0 (HASH_SFH, prepend into bucket, bucket expansion relink, noexpand) so lookups, set, remove and has_user_value pick the duplicate C picks. Drops the #681 exclusions from the config_ini_diff fuzz target. Local-Gate: v1 tree=9c3e09f6471296185d9567a45fd376793118090e secs=382 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run Ci-Attestation: {"at":1791982716,"gate":"rust/all/fmt","host":"linux-x86_64","key":"5ea7036a2f29042cad6c4ae89fee908813c7409af1edce59be5ff76a105bed10","lane":"lint","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":35,"stamp":"da7547d62810af8328a48e78d5deea3a","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"5ea7036a2f29042cad6c4ae89fee908813c7409af1edce59be5ff76a105bed10","lane":"lint","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":35,"stamp":"ceb1590ba02e0e9900b31117cb9f5676","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"95ccd8683f3f6956d13d7a6954733dd2ec5fc2b8324d7fddfc1adf01244f447c","lane":"rust-test","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":87,"stamp":"9cb2c4b8ffb6cb677a71fdae4545d60f","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"4b1692d5ed039797c451a9bcaacdadda092be6824b23a63690521625219b692a","lane":"cross","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":77,"stamp":"e7e9cdc3bce485631e43fd96db4e9851","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"4b1692d5ed039797c451a9bcaacdadda092be6824b23a63690521625219b692a","lane":"cross","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":77,"stamp":"bc6800ff87bf35bfbfde2b128751e8fa","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"4b1692d5ed039797c451a9bcaacdadda092be6824b23a63690521625219b692a","lane":"cross","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":77,"stamp":"687397b996063da7cee6dfe9bc6fbbdc","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"4b1692d5ed039797c451a9bcaacdadda092be6824b23a63690521625219b692a","lane":"cross","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":77,"stamp":"4ed12c29f2b389c4b3e8de8094362a5e","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"4b1692d5ed039797c451a9bcaacdadda092be6824b23a63690521625219b692a","lane":"cross","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":77,"stamp":"152e1225f08d0035debd00f57db8e9ea","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"4b1692d5ed039797c451a9bcaacdadda092be6824b23a63690521625219b692a","lane":"cross","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":77,"stamp":"2d907092fd4bb95ce903b8b583374966","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"} Ci-Attestation: {"at":1791982716,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"6eba046c8357b16eb368cf32573659baf5d15281e50ce69137658e533a6a93e3","lane":"tier2-linux","parents":["5aaadf7a91a7a0643813c8718004a618ace2f228"],"secs":183,"stamp":"43f07e80541c7d0520455dc1bc746e24","tree":"9c3e09f6471296185d9567a45fd376793118090e","v":1,"via":"run"}
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.
Fixes #681
C adds parsed sections and items with
HASH_ADD_STRand finds them withHASH_FIND_STR. uthash prepends into bucket chains and relinks them when a chain reaches 10 entries, which reverses same-key order, so C can return an older duplicate. The port always picked the newest.Sections and items now live in a private
UtList(rust/obs-util/src/config_file/uthash_model.rs) that models uthash 2.3.0 as libobs uses it:HASH_SFH(libobs overridesHASH_FUNCTION; not Jenkins), 32 initial buckets, prepend on add, expansion trigger(expand_mult+1)*10,HASH_EXPAND_BUCKETSrelink order withexpand_mult/ineff_expands/noexpand, chain-orderHASH_FIND, and table reset when the last entry is deleted. Iteration and save order are unchanged (insertion order, as C'shh.nextlist). Lookups,config_set_*,config_remove_valueandconfig_has_user_valueall go through the same find. No public API change.Also removes the #681 exclusions from the
config_ini_difffuzz target anddocs/rust-port/fuzzing.md.RED: 5aaadf7
tests/config_file.rs):duplicate_sections_follow_uthash_expansion,duplicate_keys_follow_uthash_expansion,duplicate_keys_set_and_remove_touch_the_found_entryfail (10 sections: C returns NULL, port returned "v"; 10 keys: C "v0", port "v9").tests/config_file_duplicates_parity.rs): all 5 tests fail on master (3 proptests over 1..40 duplicates with set/remove/has/get ops and saved-byte comparison, plus the 10-section repro and every count up to 40).GREEN: 683afb4
soldr cargo test -p obs-util: all pass (parity file now also covers counts to 120 and hundreds of distinct and repeated keys)../lintok.rust/tools/linux-validate/run.sh: OFF and ON 208/208 ctest pass, exported symbols IDENTICAL (1766).ci-lint local-gate runpassed on all four lanes; head is stamped, pushed unchanged.Not verified
get16bitsonly (uthash's default on x86/arm64); big-endian hosts untested.config_ini_difffuzz target edit was not compiled or run here (needs cargo-fuzz and nightly).HASH_SORTis not used by config-file.c.