Skip to content
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

Don't let remove_dir_all recursively remove a symlink #31468

Merged
merged 2 commits into from
Feb 8, 2016
Merged

Don't let remove_dir_all recursively remove a symlink #31468

merged 2 commits into from
Feb 8, 2016

Conversation

pitdicker
Copy link
Contributor

See #29412

@rust-highfive
Copy link
Collaborator

r? @alexcrichton

(rust_highfive has picked a reviewer for you, use r? to override)

} else {
remove_dir_all_recursive(path)
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This logic looks pretty similar between here and windows, perhaps it could be lifted to std::fs and leave the recursive bits to the platform-specific modules?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Windows version is similar but a bit tricky. It uses rmdir() so it can only remove directory symlinks and not file symlinks. Unix just uses unlink(). But I don't mind if we make the distinction here or in std::fs.

Copy link
Member

Choose a reason for hiding this comment

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

Oh right, yeah, good point!

@alexcrichton
Copy link
Member

Looks good to me, thanks @pitdicker!

@alexcrichton
Copy link
Member

@bors: r+ d47036c

@bors
Copy link
Contributor

bors commented Feb 7, 2016

⌛ Testing commit d47036c with merge 227f399...

@pitdicker
Copy link
Contributor Author

O, I am very sorry. I only tested with symlinking permissions, not also without. The build will fail

@alexcrichton
Copy link
Member

@bors: r+ d1bfe9b

@bors
Copy link
Contributor

bors commented Feb 8, 2016

⌛ Testing commit d1bfe9b with merge e06f692...

@bors bors merged commit d1bfe9b into rust-lang:master Feb 8, 2016
@pitdicker pitdicker deleted the fs_tests_cleanup branch February 28, 2016 07:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants