[Lldb-commits] [lldb] [lldb] Change directory creation logic in framework-header-fix (PR #158355)
Alex Langford via lldb-commits
lldb-commits at lists.llvm.org
Fri Sep 12 13:01:01 PDT 2025
https://github.com/bulbazord created https://github.com/llvm/llvm-project/pull/158355
It's possible for this logic to fail if the build system runs this script in parallel. One instance could create the directory in between another instance's checking of its existence and attempt at creation.
Instead, always try to create it and ignore any FileExistsErrors.
rdar://160120161
>From 66a50d37bac6d40285f195957f82e7ed0a7221b6 Mon Sep 17 00:00:00 2001
From: Alex Langford <alangford at apple.com>
Date: Fri, 12 Sep 2025 12:57:16 -0700
Subject: [PATCH] [lldb] Change directory creation logic in
framework-header-fix
It's possible for this logic to fail if the build system runs this
script in parallel. One instance could create the directory in between
another instance's checking of its existence and attempt at creation.
Instead, always try to create it and ignore any FileExistsErrors.
rdar://160120161
---
lldb/scripts/framework-header-fix.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/lldb/scripts/framework-header-fix.py b/lldb/scripts/framework-header-fix.py
index 36c5c67c59d36..3447dfc29a761 100755
--- a/lldb/scripts/framework-header-fix.py
+++ b/lldb/scripts/framework-header-fix.py
@@ -115,8 +115,10 @@ def main():
unifdef_guards = ["-U" + guard for guard in args.unifdef_guards]
# Create the framework's header dir if it doesn't already exist
- if not os.path.exists(os.path.dirname(output_file_path)):
+ try:
os.makedirs(os.path.dirname(output_file_path))
+ except FileExistsError:
+ pass
if framework_version == "lldb_main":
modify_main_includes(input_file_path, output_file_path)
More information about the lldb-commits
mailing list