devcontainers / devcontainers/spec

basic image shell line-wrapping / command-recall unusable

Open
#550 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
5.7k
Forks
496
PR merge metrics
No merged PRs in 30d

Description

### Discussed in https://github.com/devcontainers/spec/discussions/456

Originally posted by **cevich** April 1, 2024
I'm not able to use Docker, so my container engine is podman (`v4.9.3`). I'm using a very basic devcontainer through the CLI. The `up` and `exec` commands seem to work fine, and I'm able to run specific commands in my devcontainer without any problems.

```json
{
"name": "basic",
"image": "mcr.microsoft.com/vscode/devcontainers/base:debian-12",
"features": {
},
"securityOpt": [
"label=disable",
"apparmor=unconfined"
],
"runArgs": [
"--userns=keep-id"
]
}
```

**The issue is**, if I `exec` the `bash` (or `zsh`) command, the terminal prompt's line-wrapping and command-recall functions misbehave and render the console unusable.

I'm able to reproduce the problem with the `mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04` image as well. I've tried within the GNOME Terminal app as well as directly on a Linux console (i.e. ctrl-alt-F3). I'm even able to reproduce directly using the image:

```
podman run -it --rm mcr.microsoft.com/vscode/devcontainers/base:debian-12 bash
root ➜ / $ cd /usr/local/bin
he next linelocal/bin $ # this is a really long command that should wrap to t
```

As you can see, it's wrapping ONTO the current terminal line, not a new one. If I press the up-arrow (command-recall) I get a similar effect. After a series of badly wrapped lines, this "off-by-one line" problem seems to stack, jumping the cursor up an extra line each time, rendering the terminal unusable.

Has anyone else experienced this behavior and/or know of a way to fix it?

Note: Inside the devcontainer or when directly running the base image, the system is aware of the terminal size, including when I change it:

```
root ➜ /usr/local/bin $ tput cols
79
root ➜ /usr/local/bin $ tput cols
80
root ➜ /usr/local/bin $ echo $COLUMNS
80
e next line/local/bin $ # this is a really long command that should wrap to the
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.