https://github.com/thorsten-klein created 
https://github.com/llvm/llvm-project/pull/189974

The `run-clang-tidy.py` script now uses `shlex.join()` to construct the command 
string for printing.

This ensures that arguments containing shell metacharacters, such as the 
asterisk in `--warnings-as-errors=*`, are correctly quoted. This allows the 
command to be safely copied and pasted into any shell for manual execution, 
fixing errors previously seen with shells like `fish` that are strict about 
wildcard expansion.

>From 96ed20cf5d1667520e110f895e412721410318e8 Mon Sep 17 00:00:00 2001
From: Thorsten Klein <[email protected]>
Date: Wed, 1 Apr 2026 17:12:05 +0200
Subject: [PATCH] [clang-tidy] Properly escape printed clang-tidy command

The `run-clang-tidy.py` script now uses `shlex.join()` to construct
the command string for printing.

This ensures that arguments containing shell metacharacters, such as
the asterisk in `--warnings-as-errors=*`, are correctly quoted. This
allows the command to be safely copied and pasted into any shell for
manual execution, fixing errors previously seen with shells like `fish`
that are strict about wildcard expansion.
---
 clang-tools-extra/clang-tidy/tool/run-clang-tidy.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py 
b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
index f4c3d00734389..f827ef492f01c 100755
--- a/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
+++ b/clang-tools-extra/clang-tidy/tool/run-clang-tidy.py
@@ -42,6 +42,7 @@
 import multiprocessing
 import os
 import re
+import shlex
 import shutil
 import subprocess
 import sys
@@ -732,7 +733,7 @@ async def main() -> None:
             progress = f"[{i + 1: >{len(f'{len(files)}')}}/{len(files)}]"
             runtime = f"[{result.elapsed:.1f}s]"
             if not args.hide_progress:
-                print(f"{progress}{runtime} {' '.join(result.invocation)}")
+                print(f"{progress}{runtime} {shlex.join(result.invocation)}")
             if result.stdout:
                 print(result.stdout, end=("" if result.stderr else "\n"))
             if result.stderr:

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

Reply via email to