This series documents multiple fill_directory() bugs, and fixes the one that is new to 2.24.0 coming from en/clean-nested-with-ignored-topic, the rest having been around in versions of git going back up to a decade. Changes since v2: * gutted the series of most the fixes, dropping the patch count from 8 to 3, due to incompatibility with git-for-windows (which interestingly has a different compat/win32/dirent.h than git.git does). The only bugs reported by a user are fixed by patch 3, and fixing the remaining bugs (which I found while investigating the one fixed bug) would require a major refactor that I don't have the time for currently. Elijah Newren (3): t3011: demonstrate directory traversal failures dir: remove stray quote character in comment dir: exit before wildcard fall-through if there is no wildcard dir.c | 9 +- ...common-prefixes-and-directory-traversal.sh | 209 ++++++++++++++++++ 2 files changed, 217 insertions(+), 1 deletion(-) create mode 100755 t/t3011-common-prefixes-and-directory-traversal.sh base-commit: da72936f544fec5a335e66432610e4cef4430991 Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-676%2Fnewren%2Fls-files-bug-v3 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-676/newren/ls-files-bug-v3 Pull-Request: https://github.com/git/git/pull/676 Range-diff vs v2: 1: 6d659b2302 ! 1: 61d303d8bd t3011: demonstrate directory traversal failures @@ -14,6 +14,18 @@ of the en/clean-nested-with-ignored-topic); the other 5 also failed under git-2.23.0 and earlier. + The old failing tests can be traced down to the common prefix + optimization in dir.c handling paths differently than + read_directory_recursive() and treat_path() would, due to incomplete + duplication of logic into treat_leading_path() and having that + function call treat_one_path() rather than treat_path(). Fixing + that problem would require restructuring treat_path() and its full + call hierarchy to stop taking a dirent; see + https://lore.kernel.org/git/xmqqzhfshsk2.fsf@xxxxxxxxxxxxxxxxxxxxxxxxx/ + and the thread surrounding it for details. + + For now, simply document the breakages. + Signed-off-by: Elijah Newren <newren@xxxxxxxxx> diff --git a/t/t3011-common-prefixes-and-directory-traversal.sh b/t/t3011-common-prefixes-and-directory-traversal.sh 2: 79f2b56174 < -: ---------- Revert "dir.c: make 'git-status --ignored' work within leading directories" 3: d6f858cab1 = 2: 49b0b628db dir: remove stray quote character in comment 4: 8d2d98eec3 = 3: 47814640e4 dir: exit before wildcard fall-through if there is no wildcard 5: d2f5623bd7 < -: ---------- dir: break part of read_directory_recursive() out for reuse 6: 9839aca00a < -: ---------- dir: fix checks on common prefix directory 7: df7f08886a < -: ---------- dir: synchronize treat_leading_path() and read_directory_recursive() 8: 77b57e44fd < -: ---------- dir: consolidate similar code in treat_directory() -- gitgitgadget