Skip to content

os::copy_file does not clean after failure. #9947

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

Closed
dpc opened this issue Oct 19, 2013 · 6 comments
Closed

os::copy_file does not clean after failure. #9947

dpc opened this issue Oct 19, 2013 · 6 comments

Comments

@dpc
Copy link
Contributor

dpc commented Oct 19, 2013

If you eg. give os::copy_file source argument that is a directory it will leave an empty destination file. I belive this is not good, and may lead to terrible, hard to debug bugs in software using it.

@hatahet
Copy link
Contributor

hatahet commented Oct 20, 2013

Does this happen on *nix, Windows, or either?

@hatahet
Copy link
Contributor

hatahet commented Oct 20, 2013

Also seems to fail if the source and destination files are the same. The resulting file is empty.

@hatahet
Copy link
Contributor

hatahet commented Oct 20, 2013

#9958

@dpc
Copy link
Contributor Author

dpc commented Oct 24, 2013

I've tested this on Linux.

hatahet added a commit to hatahet/rust that referenced this issue Oct 30, 2013
* Returns `false` if destination exists.
* Returns `false` if source is not a file (e.g. dir, sym link, etc.).

cc rust-lang#9947
@emberian
Copy link
Member

emberian commented Apr 7, 2014

std::io::fs::open appears to not does this? #10175 modified some behavior around this. @dpc can you try and reproduce on master?

@steveklabnik
Copy link
Member

We no longer have os::copy_file, and as @cmr asks, I think this just works now. @dpc if you think this is still an issue, please reproduce and let us know :)

flip1995 pushed a commit to flip1995/rust that referenced this issue Dec 29, 2022
Fix FP in needless_return when using yeet

Fixes rust-lang#9947

changelog: Fix: [`needless_return`]: don't lint when using `do yeet`
rust-lang#10109
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 a pull request may close this issue.

4 participants