[Lldb-commits] [lldb] [lldb][Windows] Fix ECHO_TO_FILE/ECHO_APPEND_FILE (PR #202612)
via lldb-commits
lldb-commits at lists.llvm.org
Tue Jun 9 06:41:51 PDT 2026
llvmorg-github-actions[bot] wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-lldb
Author: Charles Zablit (charles-zablit)
<details>
<summary>Changes</summary>
The Windows recipes for these macros were `printf "%s\n" $(1)`. The callers wrap content in single quotes (for the POSIX printf), but the test recipes run under `cmd.exe` on Windows, which keeps the single quotes literal and word-splits on spaces, and the bundled `printf` additionally mangles backslashes and spaces. The result is garbage generated files (e.g. a modulemap whose first line is `'module`, or a truncated SDK path from a "Program Files" directory).
Write the file with cmd's `echo` after stripping the callers' single quotes. `echo` runs in the recipe shell, so unlike GNU make's `$(file ...)` it still works after a preceding `MKDIR_P` in the same recipe.
---
Full diff: https://github.com/llvm/llvm-project/pull/202612.diff
1 Files Affected:
- (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (+2-2)
``````````diff
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 44aa91ef7b6fc..68067451d1d30 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -64,8 +64,8 @@ else
# valid when transferred to a remote device.
LN_SF = ln -sf $(patsubst $(dir $(2))%,%,$(1)) $(2)
ECHO = echo $(1);
- ECHO_TO_FILE = printf '%s\n' $(1) > "$(2)"
- ECHO_APPEND_FILE = printf '%s\n' $(1) >> "$(2)"
+ ECHO_TO_FILE = echo $(subst ',,$(1))> "$(subst /,\,$(2))"
+ ECHO_APPEND_FILE = echo $(subst ',,$(1))>> "$(subst /,\,$(2))"
endif
# Suppress built-in suffix rules. We explicitly define rules for %.o.
``````````
</details>
https://github.com/llvm/llvm-project/pull/202612
More information about the lldb-commits
mailing list