From 8bfd308838913164ffe7acef84a49db55b36d432 Mon Sep 17 00:00:00 2001 From: Matthieu Baerts Date: Tue, 17 Nov 2026 14:09:58 +0100 Subject: [PATCH] contest: vm: drop prompt hooks Some distributions set PROMPT_COMMAND and PS0 to print extra content around the prompt and each command, e.g. systemd's profile script printing OSC 3008 escape sequences when TERM is not 'dumb'. This content is mixed with the commands output read from the serial console, e.g. 'echo $?' parsed by bash_prev_retcode(). Unset both variables when setting PS1 after the boot, so that only the expected prompt is printed. Note that the current systemd services are already setting TERM=dumb, but it seems better to make sure this feature is always off by setting that here. Signed-off-by: Matthieu Baerts --- contest/remote/lib/vm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/contest/remote/lib/vm.py b/contest/remote/lib/vm.py index 82fe4105..d52f9c13 100644 --- a/contest/remote/lib/vm.py +++ b/contest/remote/lib/vm.py @@ -223,7 +223,8 @@ def start(self, cwd=None): self.procs = proc.children(recursive=True) + [proc] print(f"INFO{self.print_pfx} reached initial prompt") - self.cmd("PS1='xx__-> '") + # Drop prompt hooks, e.g. systemd's OSC 3008 context escape sequences + self.cmd("unset PROMPT_COMMAND PS0; PS1='xx__-> '") self.drain_to_prompt() off = len(self.log_out)