Don't delete CARGO_MANIFEST_DIR entries that shadow execroot entries - #4236
Open
HackAttack wants to merge 1 commit into
Open
Don't delete CARGO_MANIFEST_DIR entries that shadow execroot entries#4236HackAttack wants to merge 1 commit into
HackAttack wants to merge 1 commit into
Conversation
When `experimental_symlink_execroot` is enabled, the build script runner symlinks every top-level execroot entry into CARGO_MANIFEST_DIR and removes those symlinks once the script has run. `symlink_if_not_exists` deliberately tolerates an entry that is already there — it belongs to the manifest dir, not to the runner — but the path was recorded for cleanup regardless, so the runner went on to delete something it never created. A crate whose manifest dir contains a directory named like an execroot entry (`src` is enough, in any workspace with a top-level `src/`) fails the action outright, because `remove_symlink` is `remove_file` on Unix and returns EISDIR. A colliding file is worse: the removal succeeds and silently drops the crate's own file from the manifest dir.
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.
When
experimental_symlink_execrootis enabled, the build script runner symlinks every top-level execroot entry into CARGO_MANIFEST_DIR and removes those symlinks once the script has run.symlink_if_not_existsdeliberately tolerates an entry that is already there — it belongs to the manifest dir, not to the runner — but the path was recorded for cleanup regardless, so the runner went on to delete something it never created.A crate whose manifest dir contains a directory named like an execroot entry (
srcis enough, in any workspace with a top-levelsrc/) fails the action outright, becauseremove_symlinkisremove_fileon Unix and returns EISDIR. A colliding file is worse: the removal succeeds and silently drops the crate's own file from the manifest dir.