https://github.com/zibi2 created 
https://github.com/llvm/llvm-project/pull/243986

When opening the log file in `AtomicLineLogger::openLogFile`, specify 
`OF_TextWithCRLF` in addition to `OF_Append`.

On platforms like z/OS (`__MVS__`), omitting `OF_Text` tags the newly created 
file as binary and disables auto-conversion. Consequently, log lines written as 
ASCII/UTF-8 cannot be processed by native system tools like `grep`, causing 
tests such as `ClangScanDeps/logging-two-threads.c` to fail when grepping the 
log file. Adding `OF_TextWithCRLF` ensures the file is opened in text mode with 
proper file tagging and character conversion.

>From 3877c00ed84d15cab1f4413d4d9da93f77a1e9de Mon Sep 17 00:00:00 2001
From: Zibi Sarbinowski <[email protected]>
Date: Wed, 18 Nov 2026 14:49:40 -0500
Subject: [PATCH] [clang][Basic] Open AtomicLineLogger file with
 OF_TextWithCRLF

When opening the log file in AtomicLineLogger::openLogFile, specify
OF_TextWithCRLF in addition to OF_Append.

On platforms like z/OS (__MVS__), omitting OF_Text tags the newly
created file as binary and disables auto-conversion. Consequently,
log lines written as ASCII/UTF-8 cannot be processed by native system
tools like grep, causing tests such as ClangScanDeps/logging-two-threads.c
to fail when grepping the log file. Adding OF_TextWithCRLF ensures the file
is opened in text mode with proper file tagging and character conversion.
---
 clang/lib/Basic/AtomicLineLogger.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/lib/Basic/AtomicLineLogger.cpp 
b/clang/lib/Basic/AtomicLineLogger.cpp
index 592e1cd63594cf..250342ab86683f 100644
--- a/clang/lib/Basic/AtomicLineLogger.cpp
+++ b/clang/lib/Basic/AtomicLineLogger.cpp
@@ -54,7 +54,8 @@ static int openLogFile(StringRef Path) {
 #else
   int FD = -1;
   std::error_code EC = llvm::sys::fs::openFileForWrite(
-      Path, FD, llvm::sys::fs::CD_OpenAlways, llvm::sys::fs::OF_Append);
+      Path, FD, llvm::sys::fs::CD_OpenAlways,
+      llvm::sys::fs::OF_Append | llvm::sys::fs::OF_TextWithCRLF);
   if (EC) {
     llvm::errs() << "warning: unable to open log file '" << Path
                  << "': " << EC.message() << "\n";

_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to