-
-
Notifications
You must be signed in to change notification settings - Fork 646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove existing entry if any when materialising symlink #18873
Merged
Merged
Conversation
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
thejcannon
reviewed
May 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but please wait for Stu 😄
stuhood
approved these changes
May 1, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
huonw
added a commit
to huonw/pants
that referenced
this pull request
May 1, 2023
…8873) This applies a workaround that fixes pantsbuild#18809, for 2.16: before this PR, repeated commands that write the exact same contents to `dist/` will fail, if those contents include a symlink. After this patch, they will succeed. For instance, `pants export-codegen ::` twice if any codegen creates a symlink. The particular problem of failing when re-materialising an entry only surfaces with symlinks, because directories are created in "exists okay" mode, and files are truncated if they already exist. However, directories and files _do_ have problems when being materialised over an entry of a different kind (pantsbuild#17758), but fixing that seems like a broader issue, and likely too large to target 2.16 at this point. After the change in this PR, we're at least back to the behaviour in 2.15: - directly rerunning commands that write to the workspace will always succeed - rerunning after changes may or may not (and, if it does, may or may not give a valid result: pantsbuild#18849) I've started on a potential fix for pantsbuild#17758 and pantsbuild#18849 in pantsbuild#18871, but, as mentioned, it felt like it was getting too large and too "feature"-y to land for 2.16. If/when a fix along those lines lands, this workaround can likely be reverted.
huonw
added a commit
that referenced
this pull request
May 2, 2023
#18873) (#18878) This applies a workaround that fixes #18809, for 2.16: before this PR, repeated commands that write the exact same contents to `dist/` will fail, if those contents include a symlink. After this patch, they will succeed. For instance, `pants export-codegen ::` twice if any codegen creates a symlink. The particular problem of failing when re-materialising an entry only surfaces with symlinks, because directories are created in "exists okay" mode, and files are truncated if they already exist. However, directories and files _do_ have problems when being materialised over an entry of a different kind (#17758), but fixing that seems like a broader issue, and likely too large to target 2.16 at this point. After the change in this PR, we're at least back to the behaviour in 2.15: - directly rerunning commands that write to the workspace will always succeed - rerunning after changes may or may not (and, if it does, may or may not give a valid result: #18849) I've started on a potential fix for #17758 and #18849 in #18871, but, as mentioned, it felt like it was getting too large and too "feature"-y to land for 2.16. If/when a fix along those lines lands, this workaround can likely be reverted.
This was referenced May 8, 2023
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 applies a workaround that fixes #18809, for 2.16: before this PR, repeated commands that write the exact same contents to
dist/
will fail, if those contents include a symlink. After this patch, they will succeed. For instance,pants export-codegen ::
twice if any codegen creates a symlink.The particular problem of failing when re-materialising an entry only surfaces with symlinks, because directories are created in "exists okay" mode, and files are truncated if they already exist.
However, directories and files do have problems when being materialised over an entry of a different kind (#17758), but fixing that seems like a broader issue, and likely too large to target 2.16 at this point. After the change in this PR, we're at least back to the behaviour in 2.15:
pants package ::
can corrupt directory target output by leaving stale/deleted contents #18849)I've started on a potential fix for #17758 and #18849 in #18871, but, as mentioned, it felt like it was getting too large and too "feature"-y to land for 2.16. If/when a fix along those lines lands, this workaround can likely be reverted.