[Lldb-commits] [lldb] [lldb][Windows] Use extended path prefix for rmtree (PR #209409)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Tue Jul 14 02:22:44 PDT 2026
https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/209409
Prepend the build dir path with the `\\?\` prefix (https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry) to allow deleting directories that have paths longer than 260 characters.
This is a recurring problem in Swiftlang.
>From fa2a80b744944f03b760bb071cb659ebc98fa3b3 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Tue, 14 Jul 2026 10:18:34 +0100
Subject: [PATCH] [lldb][Windows] Use extended path prefix for rmtree
---
lldb/packages/Python/lldbsuite/test/lldbtest.py | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index a9c229be1a771..2fc8601f93974 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -846,7 +846,12 @@ def _ignore_enoent(func, path, exc_info):
return
raise exc_info[1]
- shutil.rmtree(bdir, onerror=_ignore_enoent)
+ # Delete via the \\?\ extended length path prefix so rmtree can
+ # remove build artifacts whose full path exceeds MAX_PATH (260).
+ rmtree_target = bdir
+ if sys.platform == "win32":
+ rmtree_target = "\\\\?\\" + bdir
+ shutil.rmtree(rmtree_target, onerror=_ignore_enoent)
lldbutil.mkdir_p(bdir)
def getBuildArtifact(self, name="a.out"):
More information about the lldb-commits
mailing list