Skip to content

Cannot get terminal window size inside toolbox via TIOCGWINSZ ioctl #1524

@broken-pen

Description

@broken-pen

Describe the bug
Getting the terminal window size via TIOCGWINSZ ioctl doesn't work inside a toolbox.

Steps how to reproduce the behaviour

  1. Install the kitty terminal emulator in a user directory, e.g. ~/.local/kitty.app
  2. Open a kitty window, e.g. by executing ~/.local/kitty.app/bin/kitty
  3. Inside kitty, run infocmp -a > xterm-kitty to save terminal capabilities
  4. Create and enter a toolbox: toolbox create && toolbox enter; there should be a warning about unknown terminal type xterm-kitty
  5. Install the kitty terminal info: sudo mv xterm-kitty /usr/share/terminfo/x/ && sudo chown root:root /usr/share/terminfo/x/xterm-kitty
  6. Leave the toolbox
  7. Run this Python snippet to fetch the terminal window size via ioctl; note the output
  8. Enter the toolbox while ensuring kitty integration: toolbox run ~/.local/kitty.app/bin/kitten run-shell
  9. Run the same Python snippet again and note the output

Expected behaviour
Outside the toolbox:

number of rows: 40 number of columns: 160screen width: 1440 screen height: 760

Inside the toolbox:

number of rows: 40 number of columns: 160screen width: 1440 screen height: 760

Same output both outside and inside the toolbox.

Actual behaviour
Outside the toolbox:

number of rows: 40 number of columns: 160screen width: 1440 screen height: 760

Inside the toolbox:

number of rows: 40 number of columns: 160screen width: 32765 screen height: 0

The window size inside the toolbox is different and obviously invalid.

Output of toolbox --version (v0.0.90+)
toolbox version 0.0.99.5

Toolbx package info (rpm -q toolbox)
toolbox-0.0.99.5-11.fc40.x86_64

Output of podman version

Client:       Podman Engine
Version:      5.1.2
API Version:  5.1.2
Go Version:   go1.22.5
Built:        Wed Jul 10 02:00:00 2024
OS/Arch:      linux/amd64

Podman package info (rpm -q podman)
podman-5.1.2-1.fc40.x86_64

Info about your OS
Fedora Silverblue 40

Additional context
Output of toolbox list -i:

IMAGE ID      IMAGE NAME                                    CREATED
649e13d69576  registry.fedoraproject.org/fedora-toolbox:40  7 weeks ago

Output of kitty --version:

kitty 0.35.2 created by Kovid Goyal

I've logged onto another computer via kitten ssh and run the Python snippet there and it found the terminal window size without issue. Running pure kitten run-shell without a toolbox also doesn't block terminal window size from being reported.

Please let me know if I forgot any info, thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    1. BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions