2

fix bug: corruption when cargo killed while writing by tompscanlan · Pull Reques...

 11 months ago
source link: https://github.com/rust-lang/cargo/pull/12744
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Contributor

What does this PR try to resolve?

fix #11386, superseding #12362

How should we test and review this PR?

Added unit test showing basic equivalency to existing write(path, content). Full test suite should exercise write.
Added tests for cargo add and remove. These are timing tests, so take a bit of time to run. 5-10s each. They may not fail every time, but do so regularly. Making the change to these two writes seems to prevent me from failing these tests at all.

Additional information

This uses tempfile::persist which was an existing dependency. atomicwrites crate, an alternative option for this fix, indicates tempfile::persist is the same thing. Since we already use tempfile as a dep, I stuck with that.

marcospb19 and stepancheg reacted with thumbs up emoji

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK