secret scan pre-commit
crashing on Windows when doing big merges
#1032
Labels
secret scan pre-commit
crashing on Windows when doing big merges
#1032
Environment
Describe the bug
When the user is about to commit a merge with many files and long file names,
ggshield secret scan pre-commit
crashes with[WinError 206] The filename or extension is too long
. This is becauseggshield
is building and executing a git command that can be longer then the maximum path length on Windows, which is approximately 32,767 with "long paths" enabled.Steps to reproduce:
You can use the following bash script in a Git shell on Windows to reproduce the error:
This script creates 200 files with file names that are a bit longer than 200 characters each, creates some changes for each of them across two branches, and finally merges the 200 changes from both branches. The kind of merge within this script is a bit artifical but demonstrates the issue that we observed during real merges.
Actual result:
The full debug log can be found here: error.log
Expected result:
ggshield
scanning for secrets and not crashing.Possible solutions:
One could start breaking the single
ls-tree
command into multiple ones once the command grows too long (depending on platform and "long path" configuration). This might apply for other subprocess executions, too.The text was updated successfully, but these errors were encountered: