Ensure that rctx.symlink invalidates correctly if it is a copy#28682
Ensure that rctx.symlink invalidates correctly if it is a copy#28682fmeum wants to merge 3 commits intobazelbuild:masterfrom
rctx.symlink invalidates correctly if it is a copy#28682Conversation
74cd481 to
4d9c878
Compare
4d9c878 to
2c1b25e
Compare
rctx.symlink invalidation on Windowsrctx.symlink invalidates correctly if it is a copy
There was a problem hiding this comment.
Code Review
This pull request correctly ensures that ctx.symlink invalidates correctly when emulated as a copy, for example on Windows. The change adds a watch on the symlink target when native symlinks are not supported. The implementation is sound and is accompanied by good tests. I've added one comment about an opportunity to improve test coverage for file permissions.
|
|
||
| self.RunBazel(args=['build', '@other_repo//:file'], cwd=work_dir) | ||
|
|
||
| def doTestSymlinkToFileInOtherRepoNoticesFileChange(self): |
There was a problem hiding this comment.
This is a great test for file content changes. To make it more robust, consider also testing the preservation of file permissions, especially the executable bit. When ctx.symlink is emulated as a copy on Windows, the file permissions are not preserved by the current implementation in WindowsFileSystem, which could lead to issues if the linked file is an executable script.
You could extend this test or add a new one where data.txt is an executable script, and the genrule attempts to execute it. This would highlight the issue and ensure the symlink emulation is correct with respect to permissions as well.
|
@bazel-io fork 9.1.0 |
|
@meteorcloudy I realized that this has an issue, will send a fix later. |
b8006d1 to
c9bb725
Compare
|
@meteorcloudy PTAL, I decided to add the symlink bit to the fingerprint since I could see cache entries without the additional watch polluting (local or remote) repo contents caches when the startup flag is flipped. I haven't managed to reproduce this in a test. |
…elbuild#28682) ### Description When `rctx.symlink` is implemented as a copy (on Windows with default settings), the target is now watched so that modifications to it are still seen through the fake "symlink". Motivation ### Build API Changes No ### Checklist - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes RELNOTES: `rctx.symlink` now implicitly watches the target if it falls back to a copy. Closes bazelbuild#28682. PiperOrigin-RevId: 873775628 Change-Id: I6bd9d38e19b20e3342802ab4a11acd319b7ac52f
…opy (#28682) (#28741) ### Description When `rctx.symlink` is implemented as a copy (on Windows with default settings), the target is now watched so that modifications to it are still seen through the fake "symlink". Motivation ### Build API Changes No ### Checklist - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes RELNOTES: `rctx.symlink` now implicitly watches the target if it falls back to a copy. Closes #28682. PiperOrigin-RevId: 873775628 Change-Id: I6bd9d38e19b20e3342802ab4a11acd319b7ac52f Commit 6dd6396 Co-authored-by: Fabian Meumertzheim <[email protected]>
Description
When
rctx.symlinkis implemented as a copy (on Windows with default settings), the target is now watched so that modifications to it are still seen through the fake "symlink".Motivation
Build API Changes
No
Checklist
Release Notes
RELNOTES:
rctx.symlinknow implicitly watches the target if it falls back to a copy.