From c637feb9e17645f16ec3c6c06a494aa843bf6d6f Mon Sep 17 00:00:00 2001 From: Tom de Vries Date: Thu, 17 Jul 2025 22:06:38 +0200 Subject: [PATCH] [gdb/testsuite] Fix regexp in gdb.base/style.exp In test-case gdb.base/style.exp, we have proc test_pagination_prompt_styling, which: - determines a "desired width" by parsing the output of "info files", - sets width to the "desired width", and - runs "info files" again. The "desired width" on my system is 88, but if I override it to 66, I run into: ... FAIL: gdb.base/style.exp: check pagination prompt styling ... due to the test classifying this line as a bad line: ... $hex - $hex is .init_array in --Type for more, ... ... This is due to a bug in this regexp: ... # For lines that don't match this pattern, we cannot comment on # where the style reset should occur, so lets just claim the line # is fine. if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } { return true } ... which is supposed to determine whether the line needs to contain a style reset. For aforementioned line, the regexp matches, so the test concludes that the line should have a style reset, and because it hasn't, it classifies it as a bad line. Fix this by making the regexp more strict: ... if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } { ... Tested on x86_64-linux. Approved-By: Andrew Burgess --- gdb/testsuite/gdb.base/style.exp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdb/testsuite/gdb.base/style.exp b/gdb/testsuite/gdb.base/style.exp index 514c3e87399..8c1bb739f50 100644 --- a/gdb/testsuite/gdb.base/style.exp +++ b/gdb/testsuite/gdb.base/style.exp @@ -859,7 +859,7 @@ proc previous_line_is_ok { str } { # For lines that don't match this pattern, we cannot comment on # where the style reset should occur, so lets just claim the line # is fine. - if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in " $str] } { + if { ![regexp "\\s+$::hex - $::hex is \[^\r\n\]+ in \033" $str] } { return true } -- 2.47.2