当我连接到我的Docker 容器和Debian 11通过远程控制,我已经设置了嘚是主 shell。当我切换到狂欢(通过输入bash
)我失去了输入小写字母的能力s
(任何其他字母,无论是小写还是大写,甚至 UTF-8 和其他非拉丁字母,都没有这样的问题)。
如果我通过以下方式连接,情况也是一样的docker attach CONTAINER_NAME
(因为狂欢是默认 shell,而不是嘚)。这个问题在各种终端应用程序中都存在,无论我以root
还是其他用户身份连接。
所有语言环境均配置为en_US.UTF-8
我怀疑问题似乎出在stty
或上.inputrc
,并且尝试了每种设置的各种变化,但无论我尝试什么,似乎都没有任何区别(我每次都会仔细检查并重新启动容器)。
此外,在加载Python 3.11控制台(由在 zsh(不是 bash!)下运行的 python cli-apps 之一启动)中,我也无法s
在其中输入小写字母。更有趣的是,虽然在 bash 中我至少可以粘贴它,但 Python 控制台根本拒绝接受粘贴的内容,基本上删除了所有字母s
。
以下是我的.inputrc 设置:
"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on
set completion-ignore-case on
# Settings ensuring certain typed ASCII charachters are printing
set output-meta on
set input-meta on
set convert-meta off
FIY:将它们全部注释掉没有帮助,在 中设置相同的设置也没有帮助/etc/inputrc
。这是当前的 stty 设置(设置为stty sane
,但我尝试了各种不同的类型):
$ stty --all
speed 38400 baud; rows 43; columns 170; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W;
lnext = ^V; discard = ^O; min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -ixon -ixoff -iuclc -ixany imaxbel -iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke -flusho -extproc
并且,以防万一locale
命令的输出(在 bash 中运行):
$ locale
LANG=en_US.UTF-8
LANGUAGE=en.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=
全局的内容/etc/inputrc
是这样的:
$ cat /etc/inputrc
# /etc/inputrc - global inputrc for libreadline
# See readline(3readline) and `info rluserman' for more information.
# Be 8 bit clean.
set input-meta on
set output-meta on
# To allow the use of 8bit-characters like the german umlauts, uncomment
# the line below. However this makes the meta key not work as a meta key,
# which is annoying to those which don't need to type in 8-bit characters.
set convert-meta off
# try to enable the application keypad when it is called. Some systems
# need this to enable the arrow keys.
set enable-keypad on
# see /usr/share/doc/bash/inputrc.arrows for other codes of arrow keys
# do not bell on tab-completion
set bell-style none
# set bell-style visible
# some defaults / modifications for the emacs mode
$if mode=emacs
# allow the use of the Home/End keys
"\e[1~": beginning-of-line
"\e[4~": end-of-line
# allow the use of the Delete/Insert keys
"\e[3~": delete-char
"\e[2~": quoted-insert
# mappings for "page up" and "page down" to step to the beginning/end
# of the history
# "\e[5~": beginning-of-history
# "\e[6~": end-of-history
# alternate mappings for "page up" and "page down" to search the history
# "\e[5~": history-search-backward
# "\e[6~": history-search-forward
# mappings for Ctrl-left-arrow and Ctrl-right-arrow for word moving
"\e[1;5C": forward-word
"\e[1;5D": backward-word
"\e[5C": forward-word
"\e[5D": backward-word
"\e\e[C": forward-word
"\e\e[D": backward-word
#$if term=rxvt
#"\e[7~": beginning-of-line
#"\e[8~": end-of-line
#"\eOc": forward-word
#"\eOd": backward-word
#$endif
# for non RH/Debian xterm, can't hurt for RH/Debian xterm
# "\eOH": beginning-of-line
# "\eOF": end-of-line
# for freebsd console
# "\e[H": beginning-of-line
# "\e[F": end-of-line
$endif
我认为我从来没有太关心过它,直到我必须使用 Python 控制台,并且我相信这是有某种联系的。
有人能提供建议吗?
更新:虽然bind '"s": self-insert'
bash 本身有帮助,但在运行建议的命令后,python 控制台仍然拒绝输入或接受小写字母s
,无论是从 zsh 还是从 bash 启动。此外,建议的bind
命令在添加到 .bashrc 时会打印相当多类似的警告,警告如下:
bind: warning: line editing not enabled
我通过将 STDERR 重定向到 /dev/null 来缓解这个问题,但问题的根本原因似乎并未解决。