Repository navigation
image-source: Read the sub-second file time on Windows too - #565
Merged
Merged
Conversation
Member
|
Verified locally (Tier 2 OFF and ON):
|
zackees
force-pushed
the
fix/image-replace-windows
branch
from
October 13, 2026 13:12
ac25111 to
d224e9b
Compare
The Image source loads its file again when it changed, and since the fix for images replaced within the same second it compares the sub-second part of the modification time. On Windows, though, libobs's os_stat() reports whole seconds only (it copies _wstat's st_mtime), so there an image replaced by one of the same size within the same second is still missed. The upstream report of that bug is from Windows 11. image_file_version_from_filetime() will turn a Windows file time (100 ns ticks since 1601, as GetFileAttributesExW() reports the last write time) into the version the source compares. The stub keeps what Windows gets today: whole seconds only. It is plain arithmetic, so the test runs on every platform. On master: write times 0.4 s apart, same second: equal versions 1 234 567 ticks past a second: sub-second part 0 2 of 4 cases fail. The controls pass: whole seconds convert to the Unix time stat() reports, and a real file read with image_file_version_get() (os_stat() here) exists with the right size, and not after it is removed. Refs obs-rust#564. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The Image source compares the sub-second part of its file's modification time to see an image replaced within the same second, but on Windows os_stat() reports whole seconds only, so there an image replaced by one of the same size within the second was still missed. On Windows, read the file's last write time and size with GetFileAttributesExW() (100 ns ticks) and convert them with image_file_version_from_filetime(). Linux and macOS keep using stat(). The Windows file is image-file-version-win32.c, built only on Windows; test_image_file_version_filetime builds it there too, so the Windows Tier 2 lane compiles and runs it. Not run on Windows here: the conversion is tested on Linux, the Windows file only checked for syntax against the documented Win32 declarations. Fixes obs-rust#564. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=fc8f579874ba1b2dd4cdfb4de74e09291be92928 secs=319 lanes=lint:run,rust-test:run,cross:run,tier2-linux:run Ci-Attestation: {"at":1791898539,"gate":"rust/all/fmt","host":"linux-x86_64","key":"87b968df0b110b096ec97e01a0960bfc6bce0542d4d6e0a40ac189c49a11cc31","lane":"lint","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":30,"stamp":"3851dc1ec257f61b0d76a75c15e1f73d","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"87b968df0b110b096ec97e01a0960bfc6bce0542d4d6e0a40ac189c49a11cc31","lane":"lint","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":30,"stamp":"d904fae1f49dee06862d987284b4d234","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"40dec6e1e8dd80d2482801eac6c63b70a654f16338ab3fe46fbf803ebb33219d","lane":"rust-test","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":113,"stamp":"64599b0a9818b8c5dcc0d7317376e74f","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/x86_64-pc-windows-msvc/clippy","host":"linux-x86_64","key":"d02db72b60fe700b89dcebef48f87774d2534c037a4801279d4437c7d657d09b","lane":"cross","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":95,"stamp":"f38ad25cc1e1622e44709951b124bfc3","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/x86_64-pc-windows-msvc/dylint","host":"linux-x86_64","key":"d02db72b60fe700b89dcebef48f87774d2534c037a4801279d4437c7d657d09b","lane":"cross","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":95,"stamp":"f109089be3e3c35066cb547d226686cc","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/aarch64-apple-darwin/clippy","host":"linux-x86_64","key":"d02db72b60fe700b89dcebef48f87774d2534c037a4801279d4437c7d657d09b","lane":"cross","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":95,"stamp":"5093fc63f352f08a249c1b3f60e91a4d","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/aarch64-apple-darwin/dylint","host":"linux-x86_64","key":"d02db72b60fe700b89dcebef48f87774d2534c037a4801279d4437c7d657d09b","lane":"cross","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":95,"stamp":"80805104ad113ee70e08d96ca555398b","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/x86_64-apple-darwin/clippy","host":"linux-x86_64","key":"d02db72b60fe700b89dcebef48f87774d2534c037a4801279d4437c7d657d09b","lane":"cross","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":95,"stamp":"0674aad3d18cca7af69fd5f9d9d99be2","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"rust/x86_64-apple-darwin/dylint","host":"linux-x86_64","key":"d02db72b60fe700b89dcebef48f87774d2534c037a4801279d4437c7d657d09b","lane":"cross","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":95,"stamp":"2a6eeeb7f1a96b6a1f7b6f7ca2429a0b","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"} Ci-Attestation: {"at":1791898539,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"0b5b656ee6028c4c5622474c30a1d21aa3825f31cd0eaa045e9087ce890550c8","lane":"tier2-linux","parents":["a6bc731c9c475ee5763bd439bedf69ee412900fa"],"secs":81,"stamp":"e54a7afdea9a4b09803369e6699d1271","tree":"fc8f579874ba1b2dd4cdfb4de74e09291be92928","v":1,"via":"run"}
zackees
force-pushed
the
fix/image-replace-windows
branch
from
October 13, 2026 13:35
d224e9b to
751df1d
Compare
Member
|
Rebased onto master with #571 (the MSVC pragma fix): the earlier Windows Rust failure was master's
|
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.
Description
On Windows, an Image source now also reloads an image replaced by one of the same size within the same second. #548 fixed that on Linux and macOS by comparing the sub-second part of the file's modification time, but on Windows
os_stat()reports whole seconds only.On Windows the source now reads the file's last write time and size with
GetFileAttributesExW()(100 ns ticks), in a Windows-onlyplugins/image-source/image-file-version-win32.c, and converts them withimage_file_version_from_filetime(), plain arithmetic built on every platform. Linux and macOS keep usingstat()as before.test/cmocka: Add failing test for the image file time on Windows: addsimage_file_version_from_filetime()with a stub that keeps whole seconds only (what Windows gets today), andtest_image_file_version_filetime, built on every platform. The cases are:stat()reports; a real file is read withimage_file_version_get()(on Windows through the new code).image-source: Read the sub-second file time on Windows too: the fix, and the Windows file in the plugin and in the test. 4 of 4 pass.Motivation and Context
Fixes #564, a follow-up to #548 (upstream obsproject/obs-studio#10700, reported by chocobclyn on Windows 11).
Not run on Windows. We have no Windows machine. The conversion is tested on Linux, and the Windows file was checked for syntax with clang against the documented Win32 declarations only.
ci/ci_scope.pyselects the Windows Tier 2 lane for this change (image-file-version-win32.c), which buildscmocka-testsand so compiles and runs the Windows code throughtest_image_file_version_filetimein both libobs modes; the Windows OBS app build (which also compiles the plugin) runs at the release gate or withci-full.How Has This Been Tested?
Both libobs lanes (
ENABLE_RUST_LIBOBSOFF and ON) on Linux, on current master:test_image_file_version_filetime: 2 of 4 fail at the RED commit, 4 of 4 pass at GREEN in each lane;test_image_file_version(the image-source: Reload an image replaced within the same second #548 test): 5 of 5.open_crashes_without_obs_corecase skipped.Types of changes
Checklist:
🤖 Generated with Claude Code