[PATCH 0/8] Directory traversal bugs
- From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
- Date
- Dec 9, 2019, 20:47 UTC
- Message-ID
- <pull.676.git.git.1575924465.gitgitgadget@gmail.com>
This series fixes multiple fill_directory() bugs, one of them 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. There is also one testcase it documents but does not fix; I tracked the code for that testcase far enough to determine that fill_directory() and its callees were not at fault; rather post-fill_directory() processing done by ls-files eventually calls git_fnmatch() and it incorrectly filters out one of the returned paths. I suspect there's a whole can of wildmatch() worms to be found following that thread, so I just opted to document my findings next to that testcase.
See https://lore.kernel.org/git/87fti15agv.fsf@kyleam.com/ for the report spawning this series.
Some comments about notable items in this series:
* Patch 2: Revert a previous patch which fixed status --ignore behavior incorrectly and which complicates code that we will need to significantly restructure in order to fix all the issues we want to address (patches 6 & 7 provide the right fix) * Patch 4: a fix to my en/clean-nested-with-ignored-topic, fixing the new bugs * Patches 6&7: the fixes to the old issues (Other patches were adding testcases, code cleanups, comment cleanups, etc.)
CC: blees@dcon.de, gitster@pobox.com, kyle@kyleam.com, sxlijin@gmail.com
Elijah Newren (8):
t3011: demonstrate directory traversal failures
Revert "dir.c: make 'git-status --ignored' work within leading
directories"
dir: remove stray quote character in comment
dir: exit before wildcard fall-through if there is no wildcard
dir: break part of read_directory_recursive() out for reuse
dir: fix checks on common prefix directory
dir: synchronize treat_leading_path() and read_directory_recursive()
dir: consolidate similar code in treat_directory()dir.c | 174 +++++++++++----- ...common-prefixes-and-directory-traversal.sh | 193 ++++++++++++++++++ t/t7061-wtstatus-ignore.sh | 7 +- 3 files changed, 323 insertions(+), 51 deletions(-) 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-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-676/newren/ls-files-bug-v1 Pull-Request: https://github.com/git/git/pull/676
-- gitgitgadget