fix: handle directories in dep-info source file hashing#2676
Open
mmastrac wants to merge 1 commit intomozilla:mainfrom
Open
fix: handle directories in dep-info source file hashing#2676mmastrac wants to merge 1 commit intomozilla:mainfrom
mmastrac wants to merge 1 commit intomozilla:mainfrom
Conversation
5e7caa4 to
0e3a517
Compare
When proc_macro::tracked::path() registers a directory as a dependency, rustc's dep-info output includes the directory path. sccache previously crashed with "Is a directory" when trying to hash these paths. Now recursively hashes all files within the directory (sorted for determinism), using relative paths as delimiters. This correctly captures directory dependencies so cache invalidation works when any file in the tracked directory changes. Fixes: mozilla#2653
0e3a517 to
3a3f315
Compare
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.
This patch has been in testing in the vercel/sccache fork for a number of weeks.
When
proc_macro::tracked::path()registers a directory as a dependency, rustc'sdep-infooutput includes the directory path. sccache previously crashed with "Is a directory" when trying to hash these paths.Now recursively hashes all files within the directory (sorted for determinism), using relative paths as delimiters. This correctly captures directory dependencies so cache invalidation works when any file in the tracked directory changes.
Note that
proc_macro_tracked_pathis a nightly-only feature, but this nightly feature is being used by aninclude_dirsfork used by the next.js team. The hashing falls back to the same file-specific hash as before in all other cases.Fixes: #2653