[Lldb-commits] [lldb] [lldb][windows] fix yaml2macho not loading file (PR #194909)
Charles Zablit via lldb-commits
lldb-commits at lists.llvm.org
Wed Apr 29 09:49:36 PDT 2026
https://github.com/charles-zablit created https://github.com/llvm/llvm-project/pull/194909
This only triggers on Windows because of git using `autocrlf` by default:
- stat() returns the on-disk file size (including the `\r\n`).
- `fopen(file, "r")` opens in text mode, translating `\r\n` to `\n`.
- `fread(bug, sb.st_size, 1, file)` reads fewer bytes than expected due to the translation above.
Switching to `"rb"` fixes the issue.
>From 7f2482beb1814913a343189eb4fa3e44252f8b26 Mon Sep 17 00:00:00 2001
From: Charles Zablit <c_zablit at apple.com>
Date: Wed, 29 Apr 2026 17:44:32 +0100
Subject: [PATCH] [lldb][windows] fix yaml2macho not loading file
---
lldb/tools/yaml2macho-core/yaml2macho.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/tools/yaml2macho-core/yaml2macho.cpp b/lldb/tools/yaml2macho-core/yaml2macho.cpp
index 85979a37d1676..c29ae282d8571 100644
--- a/lldb/tools/yaml2macho-core/yaml2macho.cpp
+++ b/lldb/tools/yaml2macho-core/yaml2macho.cpp
@@ -72,7 +72,7 @@ int main(int argc, char **argv) {
exit(1);
}
- FILE *input = fopen(InputFilename.c_str(), "r");
+ FILE *input = fopen(InputFilename.c_str(), "rb");
if (!input) {
fprintf(stderr, "Unable to open %s, exiting\n", InputFilename.c_str());
exit(1);
More information about the lldb-commits
mailing list