Bug 13581

Summary: Line wrapping over prompt in BASH
Product: [Runtime] General Runtime Reporter: phodina
Component: General RuntimeAssignee: Jason Wessel <jason.wessel>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: liezhi.yang, randy.macleod, richard.purdie, tvgamblin
Version: 2.7.2   
Target Milestone: 3.2 M4   
Hardware: x86   
OS: Multiple   
Whiteboard: BACKPORT
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know
Attachments:
Description Flags
Line wrapping over prompt in BASH none

Description phodina 2019-10-07 12:37:51 UTC
Created attachment 4576 [details]
Line wrapping over prompt in BASH

I'm reporting a bug in `bash` shell. The issue is line wrapping over the `$PS1` prompt when I type more than 80 characters. Also resizing the terminal window doesn't update the shell size.

The issue is present on `arm64` arch, but I replicaed it also in `qemux86`. 

It happens when I connect over serial as well as ssh.

I'm using:

- poky warrior: 38d5c8ea98cfa49825c473eba8984c12edf062be
- meta-openembedded warrior: 3bdbf72e3a4bf18a4a2c7afbde4f7ab773aeded9 

The target is `apollo-image` using bitbake.

build/conf/local.conf:
```
MACHINE ?= "qemux86"
DISTRO ?= "apollo-poky"
```
build/conf/bblayers.conf:
```
# POKY_BBLAYERS_CONF_VERSION is increased each time build/conf/bblayers.conf
# changes incompatibly
POKY_BBLAYERS_CONF_VERSION = "2"

BBPATH = "${TOPDIR}"
BBFILES ?= ""

LAYERS = "/workdir"

BBLAYERS ?= " \
  ${LAYERS}/poky/meta \
  ${LAYERS}/poky/meta-poky \
  ${LAYERS}/poky/meta-yocto-bsp \
  ${LAYERS}/meta-openembedded/meta-oe \
  ${LAYERS}/meta-openembedded/meta-networking \
  ${LAYERS}/meta-openembedded/meta-python \
  ${LAYERS}/meta-openembedded/meta-perl \
  ${LAYERS}/meta-apollo \
"

SSTATE_DIR ?= "/shared/sstate/"
DL_DIR ?= "/shared/downloads"

SSTATE_MIRRORS = "file://.* file:///shared/sstate/PATH"
```
I'm using another layer called `meta-apollo`.
meta-apollo/conf/distro/apollo-poky.conf:
```
require conf/distro/poky.conf

VIRTUAL-RUNTIME_base-utils = "bash"
PREFERRED_PROVIDER_virtual/base-utils="bash"
PREFERRED_PROVIDER_base-utils="bash"
```
meta-apollo/recipes-core/images/apollo-image.bb:
```
IMAGE_INSTALL_append = " \
    busybox \
    bash \
    xterm \
    kernel-modules \
"
```

There is also attachment bash_prompt.png of the `bash` running in qemu for `x86`. The first input is before resizing the terminal window and the issue is not present. However, second input is after resizing the terminal window and you can see characters `3123` overwriting the prompt. 

Interesting fact is that running `busybox` does not reproduce the issue.

I checked the `$PS1` var as possible cause but even a simple const string without special sequence is affected.

Also calling manually the `resize` script from the package xterm to resize the terminal window does not help.