Skip to content

QEMU x86_64 -nographic full system breaks host Bash terminal line wrapping state after simulation ends, requires reset or "tput smam" to fix it #110

Open
@cirosantilli

Description

@cirosantilli

At LKMC 90f3701 QEMU hacked to 4.2.0 (also happened before) Ubuntu 19.10, open a "fresh" new GNOME terminal running bash from Dash, and then just:

./run

and quit the simulation however you want, e.g. Ctrl A-X.

Now, copy paste a long character sequence multiple times on the host terminal QEMU just ran on, and after the right end of screen is reached, the pasted text stops wrapping and just disappears beyond the terminal. Same for stdout of commands e.g. 1000 equal signs:

printf "=%.0s" {0..1000}

Sometimes I've also seen it wrap back to the left, but on the same line as the current one, overwriting whatever is there, or other crazier effects.

It did not happen on aarch64 for some reason:

./run --arch aarch64

Reproduce with the following raw commands:

out/qemu/default/opt/x86_64-softmmu/qemu-system-x86_64 -nographic
out/qemu/default/opt/aarch64-softmmu/qemu-system-aarch64 -M virt -nographic

Upstream bug report: https://bugs.launchpad.net/qemu/+bug/1857449

The following restore the shell state:

reset
tput smam

However, neither of those work from inside tmux as tput smam and tput rmam have no effect there for some reason: tmux/tmux#969 Edit: can't reproduce anymore at f6c3ba7 possibly due to update to QEMU 5 or a tmux update ubuntu 20.04 tmu 3? reset now to restore the wrap.

What triggers me the most is that I don't know how to examine the shell / terminal state to find exactly the name of whatever property it is that controls this. I've tried a gazillion things like:

shopt checkwinsize
infocmp

but this just beyond my Google fu, asked at: https://unix.stackexchange.com/questions/558770/how-to-query-the-terminal-state-that-is-set-by-escape-sequences-such-as-tput-sma

Further bibliography:

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions