Description
Bug report
Bug description:
I've noticed that the Python 3.13+ REPL misbehaves in a mock shell environment. Whenever I press Del, PgUp, or PgDn, a literal ~
character is inserted.
tl;dr this happens when you run TERM=vt100 python3.13
.
Details:
I did not know what was special about the mock shell, but this did not happen with the old readline-based REPL.
When trying to figure out what's different in the mock shell I looked at env
and it was:
SHELL=/bin/bash
HISTCONTROL=ignoredups
HISTSIZE=1000
HOSTNAME=2f26bd11c076
PWD=/builddir
LOGNAME=root
HOME=/builddir
LANG=C.UTF-8
LS_COLORS=...snip...
PROMPT_COMMAND=printf "\033]0;<mock-chroot>\007"
TERM=vt100
USER=root
SHLVL=1
PS1=<mock-chroot> \s-\v\$
DEBUGINFOD_URLS=https://debuginfod.fedoraproject.org/
PATH=/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin
MAIL=/var/spool/mail/root
_=/usr/bin/env
I found out that to reproduce, all I have to do is to set TERM=vt100
. I don't know the actual meaning of that, but it changes the behavior of the new REPL, but not the old.
$ TERM=vt100 python3.13
Python 3.13.0rc2 (main, Sep 7 2024, 00:00:00) [GCC 13.3.1 20240522 (Red Hat 13.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Pressing either of Del, PgUp, or PgDn (possibly other keys?) adds a literal ~
instead of doing any of the expected actions (history traverse up, down, deleting the next character if any).
$ TERM=vt100 python3.12
Python 3.12.6 (main, Sep 9 2024, 00:00:00) [GCC 13.3.1 20240522 (Red Hat 13.3.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Pressing either of Del, PgUp, or PgDn does what it is supposed to do.
To reproduce my actual use case, first install mock. The easiest way is to use podman (or docker) with Fedora. Following https://rpm-software-management.github.io/mock/#mock-inside-podman-fedora-toolbox-or-docker-container
$ podman run --rm --privileged -ti fedora:40 bash # or docker run --cap-add=SYS_ADMIN ...
# dnf install -y mock
# useradd mockbuilder
# usermod -a -G mock mockbuilder
# su - mockbuilder
$ mock -r fedora-rawhide-x86_64 --no-bootstrap-image install python3.13 python3.12
...
$ mock -r fedora-rawhide-x86_64 shell
...
<mock-chroot> sh-5.2# python3.13
Python 3.13.0rc2 (main, Sep 7 2024, 00:00:00) [GCC 14.2.1 20240905 (Red Hat 14.2.1-2)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
CPython versions tested on:
3.13
Operating systems tested on:
Linux