[PATCH v2] ktest: Accept quoted bad term in git bisect output

From: Ricardo B. Marlière (SUSE)

Date: Tue Oct 20 2026 - 15:42:08 EST


Git commit 0c0f93e7fa64 ("bisect: print bisect terms in single quotes")
changed the completion message to put single quotes around the bisect term.
run_git_bisect() only recognizes "is the first bad commit", so it misses
completion and continues the bisect loop with newer Git.

Accept both quoted and unquoted forms to retain compatibility with older
Git versions.

Link: https://git.kernel.org/pub/scm/git/git.git/commit/?id=0c0f93e7fa645c1058226a9bfde9e2b4441edf96
Assisted-by: LLM
Signed-off-by: Ricardo B. Marlière (SUSE) <ricardo@xxxxxxxxxxxx>
---
Changes in v2:
- Dropped '(?:' usage
- Link to v1: https://patch.msgid.link/20261009-ktest-git-bisect-v1-1-1d1428f6cbf4@xxxxxxxxxxxx

To: Steven Rostedt <rostedt@xxxxxxxxxxx>
To: John Hawley <warthog9@xxxxxxxxxxxxxx>
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
tools/testing/ktest/ktest.pl | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index f94ed2e98887..5bee1c9a351a 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -3019,7 +3019,7 @@ sub run_git_bisect {
doprint "SUCCESS\n";
if ($output =~ m/^(Bisecting: .*\(roughly \d+ steps?\))\s+\[([[:xdigit:]]+)\]/) {
doprint "$1 [$2]\n";
- } elsif ($output =~ m/^([[:xdigit:]]+) is the first bad commit/) {
+ } elsif ($output =~ m/^([[:xdigit:]]+) is the first (bad|'bad') commit/) {
$bisect_bad_commit = $1;
doprint "Found bad commit... $1\n";
return 0;

---
base-commit: f47d223627f80cb7a1eb14c585fe6cb35de5e984
change-id: 20261009-ktest-git-bisect-a894f472843e

Best regards,
--
Ricardo B. Marlière (SUSE) <ricardo@xxxxxxxxxxxx>