Repository navigation
fix(find): probe roots with extended paths; stop false ENOENT and long-path recursion crash - #1285
Merged
caomengxuan666 merged 2 commits intoOct 23, 2026
Conversation
std::filesystem::exists without \\?\ false-ENOENTs roots past MAX_PATH and recursive_directory_iterator overflow-crashes when descending into them. Probe via native_path::exists_w, walk with \\?\ and map back for display, and stop hardcoding ENOENT for sharing/lock violations.
wpath() already returns std::wstring; the chained call only exists on std::filesystem::path, so MSVC rejects the translation unit. Fixes the x64 build-windows job.
Member
|
Thanks for this one — and for doing the root-cause work before opening the PR. The missing |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
findtreated existing directories past MAX_PATH as missing and could hard-crash (STATUS_STACK_BUFFER_OVERRUN/0xC0000409) when recursion walked into long child paths.Root cause (local diagnosis on WinuxCmd 1.1.20 + niubash 1.4.4):
scan_one_root/-delete/-depthusedstd::filesystem::existswithout the\\?\prefix →ERROR_PATH_NOT_FOUNDon long paths.No such file or directoryfor every failure mode.recursive_directory_iteratoralso walked unprefixed paths → stack overrun on deep/long subtrees.Changes
native_path::exists_w(attributes + extended path).to_io_path); map back withlogical_from_iosofind .still prints relative paths and-pathworks.win32_posix_error_text; sharing/lock violations becomePermission denied; true missing stays ENOENT.Refs #1283
Test plan (Windows, installed 1.1.20 + this patch)
find <dir-len≈360> -maxdepth 0 -type dfind <long> -name f.txtfind <short-root> -type fdescending long child3221226505find <missing> -maxdepth 0find . -maxdepth 0.Related shell-side record: niubash defect log D9 (2026-10-23).