[Lldb-commits] [lldb] f3d5fda - [lldb][Windows] Fix ECHO_TO_FILE/ECHO_APPEND_FILE (#202968)
via lldb-commits
lldb-commits at lists.llvm.org
Wed Jun 10 07:20:26 PDT 2026
Author: Charles Zablit
Date: 2026-06-10T15:20:21+01:00
New Revision: f3d5fda2faef6d7098f8dfb2b0278e2a278c83e6
URL: https://github.com/llvm/llvm-project/commit/f3d5fda2faef6d7098f8dfb2b0278e2a278c83e6
DIFF: https://github.com/llvm/llvm-project/commit/f3d5fda2faef6d7098f8dfb2b0278e2a278c83e6.diff
LOG: [lldb][Windows] Fix ECHO_TO_FILE/ECHO_APPEND_FILE (#202968)
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.
This is a reland of https://github.com/llvm/llvm-project/pull/202612
which add the changes in the wrong if/else branch.
rdar://179218545
Added:
Modified:
lldb/packages/Python/lldbsuite/test/make/Makefile.rules
Removed:
################################################################################
diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
index 44aa91ef7b6fc..bc78404b37588 100644
--- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
+++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules
@@ -47,8 +47,8 @@ ifeq "$(OS)" "Windows_NT"
RM_RF = rd /s /q $(subst /,\,$(1))
LN_SF = mklink /D "$(subst /,\,$(2))" "$(subst /,\,$(1))"
ECHO = echo $(1);
- ECHO_TO_FILE = printf "%s\n" $(1) > "$(subst /,\,$(2))"
- ECHO_APPEND_FILE = printf "%s\n" $(1) >> "$(subst /,\,$(2))"
+ ECHO_TO_FILE = echo $(subst ',,$(1))> "$(subst /,\,$(2))"
+ ECHO_APPEND_FILE = echo $(subst ',,$(1))>> "$(subst /,\,$(2))"
else
MKDIR_P = mkdir -p $(1)
CP = cp $(1) $(2)
More information about the lldb-commits
mailing list