Skip to content

Don't let remove_dir_all recursively remove a symlink#31468

Merged
bors merged 2 commits intorust-lang:masterfrom
pitdicker:fs_tests_cleanup
Feb 8, 2016
Merged

Don't let remove_dir_all recursively remove a symlink#31468
bors merged 2 commits intorust-lang:masterfrom
pitdicker:fs_tests_cleanup

Conversation

@pitdicker
Copy link
Copy Markdown
Contributor

See #29412

@rust-highfive
Copy link
Copy Markdown
Contributor

r? @alexcrichton

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

Comment thread src/libstd/sys/unix/fs.rs
} else {
remove_dir_all_recursive(path)
}
}
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Member

Looks good to me, thanks @pitdicker!

@alexcrichton
Copy link
Copy Markdown
Member

@bors: r+ d47036c

@bors
Copy link
Copy Markdown
Collaborator

bors commented Feb 7, 2016

⌛ Testing commit d47036c with merge 227f399...

@pitdicker
Copy link
Copy Markdown
Contributor Author

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

@alexcrichton
Copy link
Copy Markdown
Member

@bors: r+ d1bfe9b

@bors
Copy link
Copy Markdown
Collaborator

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