Closed nephewtom closed 3 years ago
It seems something on my user space, not WSL, is breaking rlwrap
.
https://github.com/Microsoft/WSL/issues/3824#issuecomment-460414884
I still have to found what it is...
Ok, I just found it and it seems having this .inputrc
file crashes readline:
# Based on Brendan Miller's initial bash .inputrc
# INSTALL
# to install, rename this file to just ".inputrc"
# place this file in your home dir. e.g. ~/.inputrc
# restart your terminal. Then, bash's keybinding for editing
# should be like ErgoEmacs.
# If no key works, try replace all \e to \M-. That's means change Esc to Meta key.
set editing-mode emacs
"\C-b": backward-char
"\C-f": forward-char
"\M-b": backward-word
"\C-M-b": backward-word
"\M-f": forward-word
"\C-M-f": forward-word
"\C-k": kill-line
"\M-DEL": backward-kill-word
"\M-d": kill-word
"\C-d": delete-char
"\C-x u": undo
"\C-x <timeout>": kill-region
"\C-c <timeout>": copy-region-as-kill
"\C-v": yank
"\C-s": forward-search-history
"\C-r": reverse-search-history
I stumbled with a similar issue with clink.
Could you find out (for the benefit of those with similar problems) which line(s) in your .inputrc
are to blame? The lines with <timeout>
look odd to me, but they shouldn't crash readline
, of course.
These two lines cause rlwrap
to crash.
"\C-M-f": forward-word
"\C-M-b": backward-word
Just having a .inputrc
file with any of those ones, crashes rlwrap:
Hope that helps.
I can reproduce the segfault on my linux system - this isn't a WSL-specific problem at all .
gdb rlwrap core
gives:
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x0000000000000000 in ?? ()
(gdb) bt
#0 0x0000000000000000 in ?? ()
#1 0x00007fddff334106 in rl_callback_read_char () from /lib64/libreadline.so.7
#2 0x0000000000405b51 in main_loop () at main.c:543
#3 0x0000000000403ad2 in main (argc=2, argv=0x7ffd656c8b08) at main.c:178
At first sight this looks like readline
bug that only shows itself with programs that use the readline
callback interface (there aren't many of those, but rlwrap
is one of them)
Yep, I just reproduced it in Linux Mint 19 on VirtualBox.
I also experienced several problems with clink which also uses readline.
I reported one which did not make it crash but had an annoying behavior.
And commented on another one which seems it makes it crash.
By the way, are you a violinist? Just curiosity...
Yes, there are many musicians that are mathematicians/programmers as well (and the other way round), and I'm one of them....
Building libreadline
with CFLAGS=-g
, linking rlwrap
with the result and then using gdb
shows that
the crash happens when (*rl_linefunc) (line);
is executed by readline
in callback.c:281
(readline 8.0) with a NULL rl_linefunc
. This means that this is almost certainly a rlwrap
-specific bug, as rlwrap
performs some trickery temporarily removing the line_handler
when a line is accepted.
This will take some time to sort out, in the meantime I changed the subject of this issue to better reflect the scope of the problem.
Yes, there are many musicians that are mathematicians/programmers as well (and the other way round), and I'm one of them....
Nice! I have played guitar (classical & flamenco) and some piano, though I do not play much lately. But I know I will practice again soon.
Building
libreadline
withCFLAGS=-g
, linkingrlwrap
with the result and then usinggdb
shows that the crash happens when(*rl_linefunc) (line);
is executed byreadline
incallback.c:281
(readline 8.0) with a NULLrl_linefunc
. This means that this is almost certainly arlwrap
-specific bug, asrlwrap
performs some trickery temporarily removing theline_handler
when a line is accepted.This will take some time to sort out, in the meantime I changed the subject of this issue to better reflect the scope of the problem.
Fine, I am glad to report this if it helps to improve rlwrap
.
I mostly use it with sqlplus
since 2012, which I can not stand it without it.
Thanks for you dedication!
I'm not convinced that \M-\C-<key>
is the right syntax to use. When I add "\M-\C-b": backward-word
to my .inputc
even the simplest possible test program that usesreadline
in callback mode behaves weirdly (I have to press ENTER twice to get it to accept a line) - although it doesn't crash.
On the other hand, if I use the syntax
"\e\C-b": backward-word
all is well, there are no crashes, and ALT+CTRL+b
behaves as expected.
rlwrap
fails to run on Windows Subsystem for Linux (WSL) on Windows 10.Version information:
I tried rlwrap binary from Ubuntu and clone/compile/run this Github rlwrap. Both fail in the same manner.
Best Regards.