With taskset -c 0 and test-case gdb.tui/resize-2.exp, I run into: ... PASS: gdb.tui/resize-2.exp: gdb width 90 tui disable^[[40;1H^M(gdb) PASS: gdb.tui/resize-2.exp: tui disable ^M^[[K(gdb) FAIL: gdb.tui/resize-2.exp: two prompt redisplays after resize (timeout) maint info screen^M Number of characters gdb thinks are in a line is 80.^M Number of characters readline reports are in a line is 79.^M Number of characters curses thinks are in a line is 90.^M Number of characters environment thinks are in a line is 80 (COLUMNS).^M Number of lines gdb thinks are in a page is 24.^M Number of lines readline reports are in a page is 24.^M Number of lines curses thinks are in a page is 40.^M Number of lines environment thinks are in a page is 24 (LINES).^M (gdb) PASS: gdb.tui/resize-2.exp: curses width after resize with TUI disabled ... Everything else in the test-case seems to work fine, the prompt we get is responsive. The two prompt redisplays is what we usually get. The test-case does "Term::resize 24 80 0" while having the settings of an earlier "Term::resize 40 90", so both dimensions change. The proc Term::resize unconditionally calls stty twice, which is why we usually see two prompt redisplays. However, it's possible that the two got merged somehow (perhaps that's done by the kernel, perhaps by the curses library, I'm not sure), in which case we'd only get one prompt redisplay. With tui enabled, there's a synchronization step in Term::resize to wait after each stty call for a message enabled by "maint set tui-resize-message on". But this is with tui disabled. The fix is to split up the resize in two steps, change one dimension at at time, and wait for one prompt redisplay for each.
The master branch has been updated by Tom de Vries <vries@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=628b136d6474df9c4bbf04b8ff1977ef7191c9e1 commit 628b136d6474df9c4bbf04b8ff1977ef7191c9e1 Author: Tom de Vries <tdevries@suse.de> Date: Mon Jun 3 07:49:24 2024 +0200 [gdb/testsuite] Fix timeout in gdb.tui/resize-2.exp When running test-case gdb.tui/resize-2.exp with taskset -c 0, I sometimes run into: ... tui disable^[[40;1H^M(gdb) PASS: $exp: tui disable ^M^[[K(gdb) FAIL: $exp: two prompt redisplays after resize (timeout) ... The test-case does "Term::resize 24 80 0" while having the settings of an earlier "Term::resize 40 90", so both dimensions change. When TUI is enabled, we call Term::resize with wait_for_msg == 1, and the proc: - calls stty to change one dimension, - waits for the message (enabled by "maint set tui-resize-message on") confirming the resize has happened, - calls stty to change the other dimension, and again - waits for the message confirming the resize has happened. Since TUI is disabled, we call Term::resize with wait_for_msg == 0 because the message is not printed, so stty is called twice, and afterwards we check for the results of the two resizes, which is the test that is failing. The problem is that not waiting for a response after each stty call opens up the possibility of the responses being merged. Fix this by calling Term::resize twice, changing one dimension at a time, and waiting for a single prompt redisplay after each one. Tested on x86_64-linux. Reviewed-By: Alexandra Petlanova Hajkova <ahajkova@redhat.com> PR testsuite/31822 Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31822
Fixed.