Skip to content

Commit 94c0655

Browse files
dschoGit for Windows Build Agent
authored andcommitted
max_tree_depth: lower it for clangarm64 on Windows
Just as in b64d78a (max_tree_depth: lower it for MSVC to avoid stack overflows, 2023-11-01), I encountered the same problem with the clang builds on Windows/ARM64. The symptom is an exit code 127 when t6700 tries to verify that `git archive big` fails. This exit code is reserved on Unix/Linux to mean "command not found". Unfortunately in this case, it is the fall-back chosen by Cygwin's `pinfo::status_exit()` method when encountering the NSTATUS `STATUS_STACK_OVERFLOW`, see https://github.com/cygwin/cygwin/blob/cygwin-3.6.1/winsup/cygwin/pinfo.cc#L171 I verified manually that the stack overflow always happens somewhere around tree depth 1403, therefore 1280 should be a safe bound in these instances. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent f66ae8c commit 94c0655

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

environment.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,21 @@ int max_allowed_tree_depth =
9090
* tree depth; This value seems to be low enough.
9191
*/
9292
1280;
93+
#else
94+
#if defined(GIT_WINDOWS_NATIVE) && defined(__clang__) && defined(__aarch64__)
95+
/*
96+
* Similar to Visual C, it seems that on Windows/ARM64 the clang-based
97+
* builds have a smaller stack space available. When running out of
98+
* that stack space, a `STATUS_STACK_OVERFLOW` is produced. When the
99+
* Git command was run from an MSYS2 Bash, this unfortunately results
100+
* in an exit code 127. Let's prevent that by lowering the maximal
101+
* tree depth; This value seems to be low enough.
102+
*/
103+
1280;
93104
#else
94105
2048;
95106
#endif
107+
#endif
96108

97109
#ifndef PROTECT_HFS_DEFAULT
98110
#define PROTECT_HFS_DEFAULT 0

0 commit comments

Comments
 (0)