Repository navigation
feat(libobs): port file-serializer to Rust - #66
Conversation
|
Review note before this can merge: #71 (now on master) fixed the C safe-save in |
|
Rebased onto master and brought in line with #71 (TDD):
The local gate passes: 28/28 cmocka OFF and ON, identical exports. Known difference: C also logs a warning on a failed save; the safe core has no logger. |
e8cb84d to
a9a6482
Compare
The safe core uses std::fs::File. Safe output still writes a temp file and renames it over the destination on free. Buffered file-serializer stays in C, and the cmocka tests are unchanged. A null path to file_output_serializer_init_safe returns false and creates nothing. C would build a temp name from the extension and unlink a null path on free. Seek codes other than current and end seek from the start, matching the C switch. Tier 1 and Tier 3 cover the cmocka cases. Mutating the negative start seek fails input_seek_matches_oracle. Refs obs-rust#44
file-serializer.c now replaces safe saves through os_safe_replace (obs-rust#71), so the oracle host provides it, following platform-nix.c and platform-windows.c. fseeko/ftello are POSIX and hidden by -std=c11; GCC 14 rejects the implicit declarations, so expose them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mirror test_file_serializer_safe.c (obs-rust#71) in Tier 1: a write to a /dev/full temporary file and a vanished temporary file must both leave the original destination intact. The port still unlinks the destination and renames the temporary file over it regardless of errors, so with ENABLE_RUST_LIBOBS=ON test_file_serializer_safe fails all three failure cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow the C fix in obs-rust#71. Output buffers writes like fwrite, records a short write or failed flush, and on drop installs the temporary file with a single rename only after a clean write, instead of unlinking the destination and renaming over it regardless of errors. A full disk or a failed rename now leaves the original intact. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=fcf1cb0bdb4abc27e9d34fe187941805188dcae0 secs=83 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791594782,"gate":"rust/all/fmt","host":"linux-x86_64","key":"c73e811b613c4ea37b837bf9f54f9f316207792d1e5c5b9be7f477eb0e01b927","lane":"lint","parents":["3e595ef9ff93286bf5b6a6f3023c750d328dec24"],"secs":28,"stamp":"58051c4640b294d4cac649658c2c39c2","tree":"fcf1cb0bdb4abc27e9d34fe187941805188dcae0","v":1,"via":"run"} Ci-Attestation: {"at":1791594782,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"c73e811b613c4ea37b837bf9f54f9f316207792d1e5c5b9be7f477eb0e01b927","lane":"lint","parents":["3e595ef9ff93286bf5b6a6f3023c750d328dec24"],"secs":28,"stamp":"c02d0c41fac01b88105f8a282574db34","tree":"fcf1cb0bdb4abc27e9d34fe187941805188dcae0","v":1,"via":"run"} Ci-Attestation: {"at":1791594782,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"9d7df3a023b40aa8216e052722ab7cc7d37469f720fb78c495f0c7f7c105f1bc","lane":"rust-test","parents":["3e595ef9ff93286bf5b6a6f3023c750d328dec24"],"secs":18,"stamp":"d931f130ec57616189be2d03ba13d832","tree":"fcf1cb0bdb4abc27e9d34fe187941805188dcae0","v":1,"via":"run"} Ci-Attestation: {"at":1791594782,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"9338b4f97214c3bbc516bb75440c537403b08a3d8d2e9095949ec77be6b6c923","lane":"tier2-linux","parents":["3e595ef9ff93286bf5b6a6f3023c750d328dec24"],"secs":37,"stamp":"2a152f1bbd28b20fe4d8b44bb44cff2d","tree":"fcf1cb0bdb4abc27e9d34fe187941805188dcae0","v":1,"via":"run"}
2e9f882 to
8d49b4d
Compare
13ef914 to
dfc685d
Compare
With the Windows oracle building again (obs-rust#74), input_matches_oracle found that after a failed _fseeki64 (one landing before the start of the file) the MSVC CRT reports its read-ahead position from ftell. Both sides return -1; Rust keeps the position as glibc does. On Windows the input comparison checks that -1 and stops there. Record the difference, and the missing warning log on a failed safe save, in rust/README.md. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=af6c1d467e1551e44394ac0ed933a49ee8329732 secs=32 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791596249,"gate":"rust/all/fmt","host":"linux-x86_64","key":"5e67410701c0f219a0353f5909b9e19624ab671790cfe92bd95264cef509c915","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":11,"stamp":"6701613336c9f29cbb91278474f4fcd4","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"} Ci-Attestation: {"at":1791596249,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"5e67410701c0f219a0353f5909b9e19624ab671790cfe92bd95264cef509c915","lane":"lint","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":11,"stamp":"2f3333d9e4d59c9c82dec892e444a51d","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"} Ci-Attestation: {"at":1791596249,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"8b92eab9448ac56fdcfad134d08ffba37ef650d57839c60e1910570f28bbd8d5","lane":"rust-test","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":4,"stamp":"0f1e4a0b1c725df9a339a74fad37f151","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"} Ci-Attestation: {"at":1791596249,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"8f2b1bafa720af13850ed75a3310309eeaaca37a317f94d3d3286b1217a3f817","lane":"tier2-linux","parents":["3c251ccbef791f1df303faef0fe0faa95c4aa0ef"],"secs":17,"stamp":"50cbc822a6b4e74feab4fd1ed6645af9","tree":"af6c1d467e1551e44394ac0ed933a49ee8329732","v":1,"via":"run"}
dfc685d to
cd1c641
Compare
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=f8f345fc846645c43b3c2eaa8beba80e61170919 secs=50 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791650348,"gate":"rust/all/fmt","host":"linux-x86_64","key":"5d788f859986e843d38c8eeda4bdd0dbf879a6b1ab69e87735fa7dc8a903072e","lane":"lint","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":15,"stamp":"b5ade2b00bc86726d90ce0af4807848f","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"} Ci-Attestation: {"at":1791650348,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"5d788f859986e843d38c8eeda4bdd0dbf879a6b1ab69e87735fa7dc8a903072e","lane":"lint","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":15,"stamp":"ada418f2ad1451744b412aa5f061905b","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"} Ci-Attestation: {"at":1791650348,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"2db21c07af54c47d710bfd0a2f9c401541637e3b4128840e6cfc5925e13df843","lane":"rust-test","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":10,"stamp":"05e830091e25865912b880bab7f6fd3a","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"} Ci-Attestation: {"at":1791650348,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"6cd30a151325eaae1cd37d93dd390e21ad24845efbac72b5338eb6cf7df95d20","lane":"tier2-linux","parents":["e9d5e41e39e22729c453774feb82c8430e17a8f8"],"secs":25,"stamp":"181b109c7353cb8952c42dfcf0124aad","tree":"f8f345fc846645c43b3c2eaa8beba80e61170919","v":1,"via":"run"}
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=21926a8ffae3e3de7be0daaa6a529723f7497869 secs=50 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791654631,"gate":"rust/all/fmt","host":"linux-x86_64","key":"6277551b1197bae61a0a3563f9047b17c1e6d651b5cab860d7def119d1cbc569","lane":"lint","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":12,"stamp":"92e0f34f8074164ecb0208cbd6f8ab26","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"6277551b1197bae61a0a3563f9047b17c1e6d651b5cab860d7def119d1cbc569","lane":"lint","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":12,"stamp":"4d3ace010dbaab4ed252006d22ec59aa","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"c6b1b608fc16817859a28490ada2b38a926103a0094ec23e3bb7d594979793d7","lane":"rust-test","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":18,"stamp":"d73d3c14d2d133a677293234ca581902","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"d05a3c8a53e501ee21ca4d301b5ba053c0dccd6b86b39d46af0486606d1d851e","lane":"tier2-linux","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":20,"stamp":"7dedfefe7e32a22a666716a1fd3efcb5","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"}
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=1b426910df018155f8be2a2ed4dc5fd8b42d68a0 secs=17 lanes=lint:reused@12a747713c0b,rust-test:reused@8f0383f521c9,tier2-linux:run Ci-Attestation: {"at":1791655075,"gate":"rust/all/fmt","host":"linux-x86_64","key":"12a747713c0b7b727bbfb48e33e2c7c1aa431a3c77062fee88a56e5821c8b6c5","lane":"lint","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"58719f015cf7d13d7f971c86c36023dd","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655075,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"12a747713c0b7b727bbfb48e33e2c7c1aa431a3c77062fee88a56e5821c8b6c5","lane":"lint","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"42c3a2e402903d1da67f91e332763625","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655075,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"8f0383f521c9857941f5429d53f8403e48869775747f8ce4edeee1af4e935da8","lane":"rust-test","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"814d385ae14911c99b750eff7d8faa6a","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655401,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"2e94b41fc041e0c98bd1709f7ab30cb7f5b5b835b799b4c3abb2c5414d4b62ec","lane":"tier2-linux","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":17,"stamp":"e6e3337d94f8a4dbafc4a9892b369084","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"run"}
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98/#88: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=44ac22e2f9bf9093f2a87bc1c0860393942c7f05 secs=31 lanes=lint:reused@9b0282a9e1c3,rust-test:reused@e3680ff66806,tier2-linux:run Ci-Attestation: {"at":1791656844,"gate":"rust/all/fmt","host":"linux-x86_64","key":"9b0282a9e1c35c80eae0d4f0c7540b1c3b1c9f193daad522570bc7b20e609cdc","lane":"lint","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"ed3cee40895adfa7780a781e7ead1f4d","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791656844,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"9b0282a9e1c35c80eae0d4f0c7540b1c3b1c9f193daad522570bc7b20e609cdc","lane":"lint","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"9bde047cbb6c054fa18fa8143826c0c7","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791656844,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"e3680ff66806191a1385606c7996530d1becc162ef5a3444eeefce614a7d0c02","lane":"rust-test","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"46cf777b2d672af2f62536e2d4132bf2","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791657116,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"99939507781ddefb1aa7855e1a0c9b4af9092524f38999d7db36a74a20f1ccce","lane":"tier2-linux","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":31,"stamp":"8164638665d4208fabc4b0a768fbc870","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"run"}
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98/#88/#105: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=58f2156a689831720a1e6ad9004041e400917579 secs=135 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791658556,"gate":"rust/all/fmt","host":"linux-x86_64","key":"e533312cff231c50944045005e90c2b48ce1920b317c9037a705bfda5b49ef4c","lane":"lint","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":17,"stamp":"a33efc3cd6c98f3fbd2fa57e9a61a281","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"e533312cff231c50944045005e90c2b48ce1920b317c9037a705bfda5b49ef4c","lane":"lint","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":17,"stamp":"fb2d0a58bcefb05085a4b512fc916740","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"1a00cb7a8eb7b67b33a108e748711133d604e544b254813435cc1ca5ea24cd26","lane":"rust-test","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":22,"stamp":"d80b75173a27c995da2676193fa36904","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"a950373231b455174e5c031fe578e1e48c61e04f0387195a7ddc0e265e371e15","lane":"tier2-linux","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":96,"stamp":"f1c2d81609277e26492a5a3f3553cd9c","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"}
Description
Ports
libobs/util/file-serializer.cto Rust. The safe core usesstd::fs::File. Reads and writes loop until a short zero or a real error, so one short syscall does not fall behindfread/fwrite. Safe output still writes a temp file and renames it over the destination on free.fcloseonly flushes, so this does notfsync.buffered-file-serializer.cstays C.test/cmocka/test_file_serializer.cis unchanged. WithENABLE_RUST_LIBOBS=ONthe buffered cases still run against the original C file, and the plain file cases run against the Rust shim.Seek codes other than current and end seek from the start. The C switch initializes the origin to
SEEK_SETand only replaces it for those two. The array-serializer helper returnsNoneoutside 0..=2, so the file port keeps its own mapping.A null path to
file_output_serializer_init_safereturns false and creates nothing. C would build a temp name from the extension alone andos_unlink(NULL)on free. Plain output init and input init with a null path still match C: output leaves the serializer untouched, input stores a null pointer and returns false.Motivation and Context
Issue #44 still has the file serializer open. This is that file only. The public functions in
file-serializer.hare unchanged. It does not close #44; buffered-file-serializer, config-file, platform, threading, pipe, task, and profiler are still there.Refs #44
How Has This Been Tested?
macOS 27.0.1, Apple Silicon (arm64), Rust 1.97.
./lint: clang-format, gersemi, rustfmt, clippy-D warnings. Pass.soldr cargo test --workspace --locked: Tier 1 and Tier 3, including proptest against the original C compiled as an oracle. Pass. The cmocka file-serializer cases are mirrored on the safe core. The parity tests drive the C ABI.input_seek_matches_oraclefailed (ret0 vs -1). Reverted.ubuntu:26.04arm64:test_file_serializerpassed withENABLE_RUST_LIBOBSOFF and ON. The other cmocka tests passed in that same pair. libobs exports were identical (1752 symbols).file-serializer.c.ois not compiled into the ON build.That Docker run used the
run.shand Dockerfile fixes from #61 so the image would build on arm64 and the script would start under macOS bash 3.2. Those two files are not in this branch. Windows was not run here.Types of changes
Checklist: