Skip to content

Fix Windows bootstrap panic on invalid symlink removal (issue #143045) #143052

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

hasip-timurtas
Copy link

@hasip-timurtas hasip-timurtas commented Jun 26, 2025

Fix Windows bootstrap panic on invalid symlink removal by trying fs::remove_file first and falling back to fs::remove_dir.

r? @ghost

@rustbot
Copy link
Collaborator

rustbot commented Jun 26, 2025

r? @albertlarsan68

rustbot has assigned @albertlarsan68.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 26, 2025
@workingjubilee
Copy link
Member

@hasip-timurtas Please make your PR description concise so your reviewer does not waste time reading it. It should only need to be about two sentences for a change of this size.

@workingjubilee workingjubilee added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 26, 2025
@workingjubilee
Copy link
Member

Oh, your original commit message contains r? @ghost

That's something for guiding rustbot. You need to put it in your PR description for it to work. I can help, though, by unassigning your reviewer, since r? @ghost is for a PR that you do not intend to have reviewed.

@rustbot
Copy link
Collaborator

rustbot commented Jun 26, 2025

Failed to set assignee to ghost: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@hasip-timurtas
Copy link
Author

@workingjubilee please check if it's ok now 🙂

@workingjubilee
Copy link
Member

@hasip-timurtas Yes, that looks good to me. You may want to remove the r? @ghost from your commit message but a final decision there is up to the reviewer. Feel free to use r? again for your previous reviewer and to @rustbot ready.

@hasip-timurtas hasip-timurtas force-pushed the fix-143045-windows-symlink-removal branch from dda6ab8 to baa9fcf Compare June 26, 2025 19:23
- Corrected a typo in the error message from "Couldn’t" to "Couldn't".
- Enhanced the logic for removing symlinks on Windows to handle invalid targets more gracefully by attempting to remove them as files before falling back to directory removal.
@hasip-timurtas hasip-timurtas force-pushed the fix-143045-windows-symlink-removal branch from baa9fcf to d7eeb7d Compare June 26, 2025 19:46
Copy link
Member

@ChrisDenton ChrisDenton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment is incorrect and I also don't think the code is the correct fix. Both remove_file and remove_dir can remove symlinks. However, remove_dir can only remove directory symlinks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants