-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix blatant logic bug in FileFunction that causes incorrect FileValue…
…s on incremental evaluations. For a path like "<prefix>/b", we should be using FileStateValue(r/b), where "r" is the fully resolved path of "<prefix>", when we construct the FileValue. This is important in the case where "<prefix>" has a different resolved path (due to ancestor directory symlinks). This was the intent of the FileFunction + FileStateValue algorithm, but the code's structure hid the bug. While I'm here, also slightly improve this. The bug is: if "r/b" changes (e.g. goes from a directory to a symlink, or goes from a symlink pointing to t1 to a symlink pointing to t2), then the Skyframe's diff will correctly contain FileStateValue(r/b). But if FileFunction(<prefix>/b) uses FileStateValue(<prefix>/b), then FileValue(<prefix>/b) will be wrong. Note that FileFunction#resolveFromAncestors is already aptly declaring the dep on FileValue(r/b) -- the bug is that we're not using it when constructing the FileValue! Fwiw, this bug is most easily exploited when multiple levels of directory symlinks are involved. That's a fairly obscure setup, so I'm not super surprised it took us this long to notice this bug. RELNOTES: None PiperOrigin-RevId: 232803261
- Loading branch information
Showing
3 changed files
with
76 additions
and
44 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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