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
std::fs::create_dir_all will stack overflow with big paths #124309
Comments
I can see two ways of fixing this. Change this so it's not recursive; Lines 2601 to 2613 in 40dcd79
Or defer to platform-specific implementations so that they can use the most efficient method for their platform. |
I did So I'm not sure there's a better way to do this in a platform specific way. Looks like the correct solution would be to just do it iteratively. As a side note, deleting that huge directory tree (that looks like a/a/a/a/.../a) took |
On that side note, removing it didn't seem that slow on my machine. I kept pushing |
I'm on W10. Maybe W11 got better at doing this? Or the rm command from MSYS2 doesn't play well with how Windows expects things to be done. |
@rustbot claim |
I tried this code:
I expected to see this happen: doesn't stack overflow
Instead, this happened:
std::fs::create_dir_all
with a big path with many uncreated directories will stack overflow on Windows. The max path is 32767, which can technically result in ~16383 recursive calls, which will stack overflow the 1mb default stack on Windows.Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: