Re: [PATCH] clang-tools: Import os for broken pipe handling
From: Ting-Han Hou
Date: Wed Sep 30 2026 - 04:01:48 EST
From: Ting-Han Hou <ue081723@xxxxxxxxx>
Date: Sat, 26 Sep 2026 08:52:24 +0800
Subject: [PATCH] clang-tools: Import os for broken pipe handling
The BrokenPipeError handler in run-clang-tools.py calls os.open() and
os.dup2() without importing os. If this handler is reached, it raises
NameError instead of redirecting stdout and exiting with status 1.
Import os so the handler can work as intended.
Fixes: 87c7ee67deb7 ("scripts: handle BrokenPipeError for python scripts")
Assisted-by: LLM
Signed-off-by: Ting-Han Hou <ue081723@xxxxxxxxx>
---
Hi Nathan,
Sorry about the formatting issue. The diff header was wrapped in my
previous email. Here is the corrected patch; the code change is
unchanged.
Thanks,
Ting-Han
scripts/clang-tools/run-clang-tools.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/scripts/clang-tools/run-clang-tools.py
b/scripts/clang-tools/run-clang-tools.py
index e78be82..79d58b3 100755
--- a/scripts/clang-tools/run-clang-tools.py
+++ b/scripts/clang-tools/run-clang-tools.py
@@ -12,6 +12,7 @@ compile_commands.json.
import argparse
import json
import multiprocessing
+import os
import subprocess
import sys
base-commit: fe2ec83746e501645709761605c2464a44fd2929
--
2.52.0.windows.1
On Tue, 29 Sep 2026 21:59:52 +0200, Nathan Chancellor <nathan@xxxxxxxxxx> wrote:
> On 2026-09-26 08:52 +0800, 14侯廷翰 wrote:
> > From: Ting-Han Hou <ue081723@xxxxxxxxx>
> >
> > The BrokenPipeError handler in run-clang-tools.py calls os.open() and
> > os.dup2() without importing os. If this handler is reached, it raises
> > NameError instead of redirecting stdout and exiting with status 1.
> >
> > Import os so the handler can work as intended.
> >
> > Fixes: 87c7ee67deb7 ("scripts: handle BrokenPipeError for python scripts")
> > Assisted-by: LLM
> > Signed-off-by: Ting-Han Hou <ue081723@xxxxxxxxx>
> > ---
> > scripts/clang-tools/run-clang-tools.py | 1 +
> > 1 file changed, 1 insertion(+)
> >
> > diff --git a/scripts/clang-tools/run-clang-tools.py
> > b/scripts/clang-tools/run-clang-tools.py
>
> Your patch is mangled, so it cannot be applied (maybe you send it with a
> different client from your v1?). Please resend properly.
>
> --
> Cheers,
> Nathan