public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
From: David Gibson <david@gibson.dropbear.id.au>
To: passt-dev@passt.top, Stefano Brivio <sbrivio@redhat.com>
Cc: David Gibson <david@gibson.dropbear.id.au>
Subject: [PATCH 4/5] test: Handle Operating System Command escapes in terminal output
Date: Mon,  5 Jan 2026 18:53:36 +1100	[thread overview]
Message-ID: <20260105075337.1724962-5-david@gibson.dropbear.id.au> (raw)
In-Reply-To: <20260105075337.1724962-1-david@gibson.dropbear.id.au>

Our "old style" test script stuff uses raw terminal output scraped from
tmux.  This might include terminal escape sequences from the shell, or
whatever we run in it: they think they're talking to a terminal emulator
not a script, and they're not entirely incorrect.

In several places we filter out ANSI ESC-[ sequences to make this work.
However, this doesn't include ESC-] "Operating System Command" sequences.
Something I've updated in Fedora 43 generates heaps of these, which break
everything.

Add more hairy regexps to filter these out as well.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
---
 test/lib/term | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/test/lib/term b/test/lib/term
index f596364c..89e4fdbe 100755
--- a/test/lib/term
+++ b/test/lib/term
@@ -203,7 +203,7 @@ pane_wait() {
 
 	__done=0
 	while
-		__l="$(tail -1 ${LOGDIR}/pane_${__lc}.log | sed 's/^[[[][^a-zA-Z]*[a-zA-Z]//g')"
+		__l="$(tail -1 ${LOGDIR}/pane_${__lc}.log | sed 's/^[[[][^a-zA-Z]*[a-zA-Z]//g;s/^[[]][^^[]*^[[\]//g')"
 		case ${__l} in
 		*"$ " | *"# ") return ;;
 		esac
@@ -215,7 +215,7 @@ pane_wait() {
 pane_parse() {
 	__pane_lc="$(echo "${1}" | tr [A-Z] [a-z])"
 
-	__buf="$(tail -n2 ${LOGDIR}/pane_${__pane_lc}.log | head -n1 | sed 's/^[^\r]*\r\([^\r]\)/\1/' | tr -d '\r\n')"
+	__buf="$(tail -n2 ${LOGDIR}/pane_${__pane_lc}.log | head -n1 | sed 's/^[^\r]*\r\([^\r]\)/\1/;s/^[[]][^^[]*^[[\]//g' | tr -d '\r\n')"
 
 	[ "# $(eval printf '%s' \"\$${1}_LAST_CMD\")" != "${__buf}" ] && \
 	[ "$ $(eval printf '%s' \"\$${1}_LAST_CMD\")" != "${__buf}" ] &&
-- 
2.52.0


  parent reply	other threads:[~2026-01-05  7:53 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  7:53 [PATCH 0/5] Fixes for Fedora 43 (or other bitrot) David Gibson
2026-01-05  7:53 ` [PATCH 1/5] util: Be more defensive about buffer overruns in read_file() David Gibson
2026-01-06 13:37   ` Laurent Vivier
2026-01-05  7:53 ` [PATCH 2/5] migrate: Don't use terminator element for versions[] array David Gibson
2026-01-06 13:43   ` Laurent Vivier
2026-01-06 13:47   ` Laurent Vivier
2026-01-07  0:10     ` David Gibson
2026-01-05  7:53 ` [PATCH 3/5] treewide: Don't rely on terminator records in ip[46].dns arrays David Gibson
2026-01-06 13:53   ` Laurent Vivier
2026-01-07  0:11     ` David Gibson
2026-01-05  7:53 ` David Gibson [this message]
2026-01-06 14:07   ` [PATCH 4/5] test: Handle Operating System Command escapes in terminal output Laurent Vivier
2026-01-05  7:53 ` [PATCH 5/5] test: Include sshd-auth in mbuto guest image David Gibson
2026-01-06 14:11   ` Laurent Vivier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260105075337.1724962-5-david@gibson.dropbear.id.au \
    --to=david@gibson.dropbear.id.au \
    --cc=passt-dev@passt.top \
    --cc=sbrivio@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).