Skip to content

fs::create_dir_all fails for directory junctions on Windows #26716

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
alexcrichton opened this issue Jul 1, 2015 · 3 comments
Closed

fs::create_dir_all fails for directory junctions on Windows #26716

alexcrichton opened this issue Jul 1, 2015 · 3 comments
Labels
P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@alexcrichton
Copy link
Member

First reported in rust-lang/cargo#1749, it looks like if an intermediate directory is a junction on Windows then fs::create_dir_all will fail. Unfortunately the standard library doesn't provide away to create a junction, but a setup like this should work:

mkdir foo
mklink /J bar foo
use std::fs;
fs::create_dir_all("bar/test").unwrap() // this fails
@alexcrichton
Copy link
Member Author

The Cargo report claims this was a regression, so I'm going to nominate this.

@alexcrichton
Copy link
Member Author

I suspect fs::metadata(&junction).is_dir() is returning false (when it should perhaps return true), but I have not had a chance to investigate this too closely.

@alexcrichton alexcrichton added the T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. label Jul 1, 2015
@alexcrichton
Copy link
Member Author

triage: P-high

@rust-highfive rust-highfive added P-high High priority and removed I-nominated labels Jul 8, 2015
@brson brson added I-nominated regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. P-high High priority and removed P-high High priority labels Jul 8, 2015
alexcrichton added a commit to alexcrichton/rust that referenced this issue Jul 10, 2015
Previously on Windows a directory junction would return false from `is_dir`,
causing various odd behavior, specifically calls to `create_dir_all` might fail
when they would otherwise continue to succeed.

Closes rust-lang#26716
bors added a commit that referenced this issue Jul 11, 2015
Previously on Windows a directory junction would return false from `is_dir`,
causing various odd behavior, specifically calls to `create_dir_all` might fail
when they would otherwise continue to succeed.

Closes #26716
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
P-high High priority regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants