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

rustc: Handle concurrent create_dir requests #33332

Merged
merged 1 commit into from
May 3, 2016

Conversation

alexcrichton
Copy link
Member

The compiler created a directory as part of -Z incremental but that may be
hierarchically used concurrently so we need to protect ourselves against that.

@rust-highfive
Copy link
Collaborator

r? @Aatch

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

@alexcrichton
Copy link
Member Author

r? @michaelwoerister

match fs::create_dir(path) {
Ok(()) => return,
Err(ref e) if e.kind() == io::ErrorKind::AlreadyExists => return Ok(()),
Err(ref e) if e.kind() == io::ErrorKind::NotFound => {}
Copy link
Member

Choose a reason for hiding this comment

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

When do you get ErrorKind::NotFound? If the parent doesn't exist?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah that's the case where this is emulating create_dir_all instead of just create_dir, and if you create /foo/bar/baz but /foo/bar doesn't exist you'll get EEXIST (not found)

Copy link
Member

Choose a reason for hiding this comment

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

OK

@michaelwoerister
Copy link
Member

lgtm, r=me when it's compile clean.

The compiler created a directory as part of `-Z incremental` but that may be
hierarchically used concurrently so we need to protect ourselves against that.
@alexcrichton
Copy link
Member Author

@bors: r=michaelwoerister 71e6329

Manishearth added a commit to Manishearth/rust that referenced this pull request May 2, 2016
…ichaelwoerister

rustc: Handle concurrent `create_dir` requests

The compiler created a directory as part of `-Z incremental` but that may be
hierarchically used concurrently so we need to protect ourselves against that.
bors added a commit that referenced this pull request May 2, 2016
Rollup of 14 pull requests

- Successful merges: #32756, #33129, #33225, #33260, #33309, #33320, #33323, #33324, #33325, #33330, #33332, #33334, #33335, #33346
- Failed merges:
Manishearth added a commit to Manishearth/rust that referenced this pull request May 3, 2016
…ichaelwoerister

rustc: Handle concurrent `create_dir` requests

The compiler created a directory as part of `-Z incremental` but that may be
hierarchically used concurrently so we need to protect ourselves against that.
bors added a commit that referenced this pull request May 3, 2016
Rollup of 14 pull requests

- Successful merges: #32756, #33129, #33225, #33260, #33309, #33320, #33323, #33324, #33325, #33330, #33332, #33334, #33335, #33346
- Failed merges:
@bors bors merged commit 71e6329 into rust-lang:master May 3, 2016
@alexcrichton alexcrichton deleted the handle-more-races branch May 12, 2016 21:59
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.

5 participants