Skip to content
Commit eb3ee307 authored by Edgar Bonet's avatar Edgar Bonet Committed by Yann E. MORIN
Browse files

support/testing/infra/emulator.py: prevent the commands from wrapping

Traditional VT-10x terminals (and their emulators) [0] have a "magic
margins" feature that enables the last character position to be updated
without scrolling the screen: whenever a character is printed on the
last column, the cursor stays over the character, instead of moving to
the next line.

The Busybox shell, ash, attempts to defeat this feature by printing
CR,LF right after echoing a character to the last column.[1] This
doesn't play well with emulator.py. The run() method of the Emulator
class captures the output of the emulated system and assumes the first
line it reads is the echo of the command, and all subsequent lines are
the command's output. If the line made by the command + shell prompt is
longer than 80 characters, then it is echoed as two or more lines, and
all but the first one are mistaken for the command's output.

We fix this by telling the emulated system that we are using an
ultra-wide terminal with 29999 columns. Larger values would be ignored
and replaced by the default, namely 80 columns.[2]

[0] https://vt100.net/docs/vt100-ug/chapter3.html  -  DECAWM
[1] https://git.busybox.net/busybox/tree/libbb/lineedit.c?h=1_34_0#n412
[2] https://git.busybox.net/busybox/tree/libbb/xfuncs.c?h=1_34_0#n258



Signed-off-by: default avatarEdgar Bonet <bonet@grenoble.cnrs.fr>
Reported-by: default avatarThomas Petazzoni <thomas.petazzoni@bootlin.com>
Co-authored-by: default avatarYann E. MORIN <yann.morin.1998@free.fr>
Signed-off-by: default avatarYann E. MORIN <yann.morin.1998@free.fr>
parent c8c5f614
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment