From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4267A17A2E2 for ; Sun, 20 Apr 2025 05:48:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745128109; cv=none; b=srQ25TfRB1xS3BVSBCkPPhQddNmYT41btIR/kIf/0kZyi1zrnuiMokOai9UsYy2xj1u4n1iZNZBTlXODsoc73hl3ZH/wySDQfUZW8r0Jv3l1oNGvntNfAhKd6FZ5Det5W4fWTyFisf1OLpjevfgsdusppFv3tcISkzwn2J1utns= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1745128109; c=relaxed/simple; bh=ZKk84yWESdJ1cL72q6Jx6wjzX9bb+HsQCDiYc2VbBkE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nV7HNpMkDyskdFnEP6imzpPMcGxt34AY/drnW9PZE1IRSprYW78GREK87ZJO5jBqeouIObjjzPQLfVkF88989TFYIOGNzEA/vW3re9w0yiGDeYdDXb4dPeW6xI14rKziDf0qs/6Azg370uOmiyp7OeQO8cCMVw1zRTIsW+9wvhs= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=N1mK/X+Y; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="N1mK/X+Y" DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Sender:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description; bh=CLHnaD+zwZuiFnPE8lQwgIGWj9DemPyp4o50phf02w0=; b=N1mK/X+Yb+de4q1KAkd3A36H+D a99ScnyoSHwbz40rVHxV88LIGioUT7J9JuWcmGssZAALihZTSFh2DaIZSKVgJ7feE71He8IWo7DFU SarYWY+i38kMB7TVIESyO/8ONDg0qyMwL9V9NNZ6VmFTKOGP368DCxv4/1Y5Fbt7bhrSpNsOgLmlL 1XBUGwMmGgf098F8EPfaRVC2BrGLPo18hwM24/fSjSdmx/E3F+YuEyloU+M5bUDBYdyOyN1orUUzL GrH/SH3EBnTasj9RYDZah2gtMqAkQ61XaYbh9dTSpMACMG7giX19JiLA9c5skyNmRvg6t2LGWt7jh pC6o6onA==; Received: from mcgrof by bombadil.infradead.org with local (Exim 4.98.2 #2 (Red Hat Linux)) id 1u6NXW-00000002EvH-2tW8; Sun, 20 Apr 2025 05:48:26 +0000 From: Luis Chamberlain To: Chuck Lever , Daniel Gomez , kdevops@lists.linux.dev Cc: Luis Chamberlain Subject: [PATCH 5/5] crash_report.py: add a crash report Date: Sat, 19 Apr 2025 22:48:21 -0700 Message-ID: <20250420054822.533987-6-mcgrof@kernel.org> X-Mailer: git-send-email 2.49.0 In-Reply-To: <20250420054822.533987-1-mcgrof@kernel.org> References: <20250420054822.533987-1-mcgrof@kernel.org> Precedence: bulk X-Mailing-List: kdevops@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Luis Chamberlain This can be used by CIs to augment the commit log. Signed-off-by: Luis Chamberlain --- scripts/workflows/generic/crash_report.py | 109 ++++++++++++++++++++++ 1 file changed, 109 insertions(+) create mode 100755 scripts/workflows/generic/crash_report.py diff --git a/scripts/workflows/generic/crash_report.py b/scripts/workflows/generic/crash_report.py new file mode 100755 index 000000000000..10b4f958042d --- /dev/null +++ b/scripts/workflows/generic/crash_report.py @@ -0,0 +1,109 @@ +#!/usr/bin/env python3 +import os +import re +from pathlib import Path + +CRASH_DIR = Path("crashes") +ANSI_ESCAPE_RE = re.compile(r"\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])") + + +def clean_lines(text): + lines = text.splitlines() + cleaned = [] + for line in lines: + line = ANSI_ESCAPE_RE.sub("", line) + line = re.sub(r"[^\x20-\x7E\t]", "", line) + if line.strip(): + cleaned.append(line) + return "\n".join(cleaned) + + +def collect_host_logs(host_path): + entries = [] + files = sorted(host_path.iterdir()) + seen_base = set() + + # First pass: collect decoded crash files + for file in files: + if not file.is_file(): + continue + fname = file.name + + # Look for decoded crash variants first + for suffix in [".crash", ".crash_and_corruption"]: + if fname.endswith(".decoded" + suffix): + # Store the original filename (without .decoded) in seen_base + base = fname.replace(".decoded" + suffix, suffix) + seen_base.add(base) + entries.append( + { + "type": "crash", + "file": fname, + "content": clean_lines(file.read_text(errors="replace")), + } + ) + + # Second pass: collect remaining files (non-decoded crashes and other types) + for file in files: + if not file.is_file(): + continue + fname = file.name + + # Handle undecoded crash files only if we didn't already see their decoded version + for suffix in [".crash", ".crash_and_corruption"]: + if fname.endswith(suffix) and not fname.endswith(".decoded" + suffix): + if fname in seen_base: + continue # decoded version already handled + + seen_base.add(fname) + entries.append( + { + "type": "crash", + "file": fname, + "content": clean_lines(file.read_text(errors="replace")), + } + ) + + # Warnings or corruption always go in + if fname.endswith(".warning"): + entries.append( + { + "type": "warning", + "file": fname, + "content": clean_lines(file.read_text(errors="replace")), + } + ) + elif fname.endswith(".corruption"): + entries.append( + { + "type": "corruption", + "file": fname, + "content": clean_lines(file.read_text(errors="replace")), + } + ) + + return entries + + +def generate_commit_log(): + print("# Kernel crash report summary\n") + for host_dir in sorted(CRASH_DIR.iterdir()): + if not host_dir.is_dir(): + continue + logs = collect_host_logs(host_dir) + if not logs: + continue + print(f"## Host: {host_dir.name}\n") + for entry in logs: + tag = entry["type"].upper() + print(f"### [{tag}] {entry['file']}") + print("```") + print(entry["content"]) + print("```\n") + + +if __name__ == "__main__": + if not CRASH_DIR.exists(): + print(f"No crashes, filesystem corruption isues, or kernel warnings were detected on this run.") + exit(0) + generate_commit_log() -- 2.47.2