Avoid recreating cache files removed during a read - #839
Open
OskarEichler wants to merge 1 commit into
Open
Conversation
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.
Summary
A file cache read may finish after another process evicts that entry; updating its access time does not recreate an empty cache file.
File.utime does not recreate files. Only ENOENT from that operation is ignored. The already-read value is returned. General cross-process atomicity and unrelated Windows atomic-write issue #136/#773 are not addressed.
Reproduction
With
require "sprockets"; require "tmpdir":Verification
49d9f20c00ac7d9a7ee57db058961edcccd86699).bundle exec rake test: 913 tests / 4,109 assertions / zero failures/errors / four skips on Ruby 3.2.11 and 4.0.6. 25 focused external checks pass per Ruby.rake test_isolatedon both Rubies, plus 396 focused checks. Normal skips cover Windows-only, legacy-Ruby and two Sass compatibility cases. Non-terminal stdin additionally skips the Unix device check (4,107 assertions).Compatibility and limitations
Breaking changes: none intended. The incorrect behavior above changes. No public signature, dependency, serialized cache format or version changes. Older supported Rubies, JRuby and Linux are not claimed locally verified. This is a focused cache correction, not a completed review of all Sprockets behavior. Prepared with AI assistance; results above are from actual local runs.