git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH 6/6] max_tree_depth: lower it for clangarm64 on Windows
Date: Mon, 21 Apr 2025 12:39:10 +0000	[thread overview]
Message-ID: <6ebc3ef57fd0455fc70c4a8531c7ed094d9cdaff.1745239150.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1904.git.1745239150.gitgitgadget@gmail.com>

From: Johannes Schindelin <johannes.schindelin@gmx.de>

Just as in b64d78ad02ca (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 <johannes.schindelin@gmx.de>
---
 environment.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/environment.c b/environment.c
index 9e4c7781be0..cc853950bb2 100644
--- a/environment.c
+++ b/environment.c
@@ -82,9 +82,21 @@ int max_allowed_tree_depth =
 	 * the stack overflow can occur.
 	 */
 	512;
+#else
+#if defined(GIT_WINDOWS_NATIVE) && defined(__clang__) && defined(__aarch64__)
+	/*
+	 * Similar to Visual C, it seems that on Windows/ARM64 the clang-based
+	 * builds have a smaller stack space available. When running out of
+	 * that stack space, a `STATUS_STACK_OVERFLOW` is produced. When the
+	 * Git command was run from an MSYS2 Bash, this unfortunately results
+	 * in an exit code 127. Let's prevent that by lowering the maximal
+	 * tree depth; This value seems to be low enough.
+	 */
+	1280;
 #else
 	2048;
 #endif
+#endif
 
 #ifndef PROTECT_HFS_DEFAULT
 #define PROTECT_HFS_DEFAULT 0
-- 
gitgitgadget

  parent reply	other threads:[~2025-04-21 12:39 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-21 12:39 [PATCH 0/6] Support Windows/ARM64 Johannes Schindelin via GitGitGadget
2025-04-21 12:39 ` [PATCH 1/6] bswap.h: add support for built-in bswap functions Dennis Ameling via GitGitGadget
2025-04-21 12:39 ` [PATCH 2/6] config.mak.uname: add support for clangarm64 Dennis Ameling via GitGitGadget
2025-04-21 12:39 ` [PATCH 3/6] mingw: do not use nedmalloc on Windows/ARM64 Johannes Schindelin via GitGitGadget
2025-04-22  7:43   ` Patrick Steinhardt
2025-04-22  8:17     ` Dropping nedmalloc support? was " Johannes Schindelin
2025-04-21 12:39 ` [PATCH 4/6] msvc: do handle builds " Johannes Schindelin via GitGitGadget
2025-04-21 12:39 ` [PATCH 5/6] mingw(arm64): do move the `/etc/git*` location Johannes Schindelin via GitGitGadget
2025-04-21 12:39 ` Johannes Schindelin via GitGitGadget [this message]
2025-04-22  7:43   ` [PATCH 6/6] max_tree_depth: lower it for clangarm64 on Windows Patrick Steinhardt
2025-04-22  7:49     ` Johannes Schindelin
2025-04-21 13:35 ` [PATCH 0/6] Support Windows/ARM64 Junio C Hamano
2025-04-23  8:01 ` [PATCH v2 " Johannes Schindelin via GitGitGadget
2025-04-23  8:01   ` [PATCH v2 1/6] bswap.h: add support for built-in bswap functions Dennis Ameling via GitGitGadget
2025-04-23  8:01   ` [PATCH v2 2/6] config.mak.uname: add support for clangarm64 Dennis Ameling via GitGitGadget
2025-04-23  8:01   ` [PATCH v2 3/6] mingw: do not use nedmalloc on Windows/ARM64 Johannes Schindelin via GitGitGadget
2025-04-23 16:20     ` Junio C Hamano
2025-04-23  8:01   ` [PATCH v2 4/6] msvc: do handle builds " Johannes Schindelin via GitGitGadget
2025-04-23  8:01   ` [PATCH v2 5/6] mingw(arm64): do move the `/etc/git*` location Johannes Schindelin via GitGitGadget
2025-04-23  8:01   ` [PATCH v2 6/6] max_tree_depth: lower it for clangarm64 on Windows Johannes Schindelin via GitGitGadget

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6ebc3ef57fd0455fc70c4a8531c7ed094d9cdaff.1745239150.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).