mkdir: fix stack overflow with deeply nested directories
Replaced recursive parent directory creation with iterative approach to prevent stack overflow when creating directories with 200+ nesting levels.
The previous recursive implementation consumed one stack frame per directory level, causing crashes on systems with limited stack size. The new implementation collects parent directories into a vector and creates them iteratively, using constant stack space regardless of depth.
All existing functionality preserved: verbose output, permissions, SELinux context, and ACLs.
Includes regression test for 350-level directory nesting.
365711a
5 days ago
by naoNao89
-2.74%
fix(mkdir): handle verbose output for existing parent directories with .. components
When creating directories with -p -v and paths containing .. components (like test_dir/../test_dir_a), the verbose output wasn't printing messages for logical parent directories that already existed. This caused test_recursive_reporting to fail on Windows.
The fix ensures verbose messages are printed for existing parent directories in recursive mode, but only for logical directory names (not parent references ending in ..). This matches GNU mkdir behavior where all logical path components are reported even if they resolve to existing directories.
Fixes Windows CI test failures for test_mkdir::test_recursive_reporting.
cae4988
5 days ago
by naoNao89
+2.72%
style: apply rustfmt and fix clippy warnings in mkdir
- Format long method chains across multiple lines
- Remove trailing whitespace
- Use next_back() instead of last() to avoid needless iterator traversal