Closed Noammac closed 4 years ago
I think it is caused by cl-readline
.
Can you check the library works properly?
Some sample codes could be found at the wiki page of cl-readline.
vinadrel/cl-readline-example
works with some issues, such as C-c
not being handled and C-o
only writing inserted text
.
I think that is expected behavior, though I just took a quick look at the code. How about syntax highlighting? Please check if it works.
Also, let me know what kind of readline library you use.
Syntax highlighting works.
I use cl-readline as installed by quicklisp.
On Sat, 26 Jan 2019 at 16:45, TANI Kojiro notifications@github.com wrote:
Also, let me know what kind of readline library you use.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/koji-kojiro/cl-repl/issues/44#issuecomment-457836724, or mute the thread https://github.com/notifications/unsubscribe-auth/ASpZq5QiMvGZyUcbd9j5E4GGTo2ZNivYks5vHGoYgaJpZM4aT390 .
Sorry, I misunderstood. No idea at this time... How did you install cl-repl?
Using roswell. ros install koji-kojiro/cl-repl
hmm... I'm sure that is problem around cl-readline, but I don't know what goes wrong...
@Noammac Would you mind tryting the following?
$ ros install koji-kojiro/cl-readline-test
$ cl-readline-test
cl-readline-test
is a simple application for investigation. That just echoes inputed text. Please report if it works correctly or not.
Also please let me show the compilation message appearing while executing ros install ~
.
Installing from github koji-kojiro/cl-readline-test
To load "cl-readline-test":
Load 1 ASDF system:
cl-readline-test
; Loading "cl-readline-test"
..................................................
[package cl-readline-test]
; compiling file "/home/noammac/.roswell/local-projects/koji-kojiro/cl-readline-test/package.lisp" (written 01 FEB 2019 07:22:23 PM):
; compiling (IN-PACKAGE :CL-USER)
; compiling (DEFPACKAGE :CL-READLINE-TEST ...)
; wrote /home/noammac/.cache/common-lisp/sbcl-1.4.13-linux-x64/home/noammac/.roswell/local-projects/koji-kojiro/cl-readline-test/package-tmpJAIDFZTC.fasl
; compilation finished in 0:00:00.001
; compiling file "/home/noammac/.roswell/local-projects/koji-kojiro/cl-readline-test/main.lisp" (written 01 FEB 2019 07:22:23 PM):
; compiling (IN-PACKAGE :CL-READLINE-TEST)
; compiling (DEFUN MAIN ...)
; wrote /home/noammac/.cache/common-lisp/sbcl-1.4.13-linux-x64/home/noammac/.roswell/local-projects/koji-kojiro/cl-readline-test/main-tmp8V3J6PE9.fasl
; compilation finished in 0:00:00.001
[1/3] System 'cl-readline-test' found. Loading the system..
[2/3] Processing build-hook..
[3/3] Attempting to install the scripts in roswell/ subdirectory of the system...
Found 1 scripts: cl-readline-test
/home/noammac/.roswell/bin/cl-readline-test
up to date. stop
cl-readline-test
:* Ctrl-D to exit.
> This is a test.
This is a test.
> ω
ω
> bye.
Not a hitch with cl-readlne-test
hmm...
Could you delete ~/.roswell/local-project/koji-kojiro/cl-repl
and then re-install cl-repl?
Or, delete .roswell
and re-install everything if you don't mind.
rm -rf
d .roswell
and reinstalled. I still get the error.
Sorry, I found that I misread the backtraces first you showed me. The error is not caused by cl-readline, though I'm not sure where it comes from...
Same here.
Same here. I noticed that disabling syntax highlighting makes everything turn back into normal.
Thank you for the report. Could you explain in more detail? How did you disable syntax highlighting?
Of course. Sorry for the lack of information.
I disabled syntax highlighting from .replrc
. Here is the configuration I use currently:
(in-package :repl-user)
(color-scheme "off")
(disable-syntax)
I also tried removing both cl-repl
and ros-repl
; didn't work. If I comment out the (disable-syntax)
line, anything evaluated breaks.
EDIT: Turning on or off the color scheme doesn't seem to affect the behaviour of the program.
I'm having the same issue on Void Linux, packages: sbcl-1.5.2_1, libreadline8-8.0.000_1, building cl-repl directly from within system SBCL: (ql:quickload :cl-repl)
from quicklisp/local-projects.
To try and find out what's going on, I did the following:
$ sbcl
This is SBCL 1.5.2, an implementation of ANSI Common Lisp.
More information about SBCL is available at <http://www.sbcl.org/>.
SBCL is free software, provided as is, with absolutely no warranty.
It is mostly in the public domain; some portions are provided under
BSD-style licenses. See the CREDITS and COPYING files in the
distribution for more information.
* (ql:quickload '(:swank :cl-repl))
[...]
* (swank:create-server)
;; Swank started at port: 4005.
4005
At this point, I setup tracing for functions cl-repl::read-input
and callees, then started the repl without the debugger hooks (important! otherwise SLIME debugger has no access), then I tried to evaluate 42
in cl-repl, exiting the debugger on each break:
* (in-package :cl-repl)
#<PACKAGE "CL-REPL">
* WARNING: System definition file #P"/home/miki/quicklisp/dists/quicklisp/software/cl-ppcre-20180831-git/cl-ppcre.asd" contains definition for system "cl-ppcre-test". Please only define "cl-ppcre" and secondary systems with a name starting with "cl-ppcre/" (e.g. "cl-ppcre/test") in that file.
WARNING:
redefining THREAD-FOR-EVALUATION (#<STRUCTURE-CLASS SWANK::MULTITHREADED-CONNECTION>
#<SB-MOP:EQL-SPECIALIZER :FIND-EXISTING>) in DEFMETHOD
* (repl)
CL-REPL> 42CORRUPTION WARNING in SBCL pid 6874(tid 0x7fb3b67102c0):
Memory fault at (nil) (pc=0x7fb3b5d0edf0, fp=0x7fb3b5d31960, sp=0x7fb3b5f67210) tid 0x7fb3b67102c0
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
CL-REPL> 42CORRUPTION WARNING in SBCL pid 6874(tid 0x7fb3b67102c0):
Memory fault at (nil) (pc=0x7fb3b5d0edf0, fp=0x7fb3b5d31960, sp=0x7fb3b5f67210) tid 0x7fb3b67102c0
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
In Emacs, I switched to the debugger's trace window with C-c T
and fetched all traces. This is what I got:
Traced specs (5) [refresh]
[untrace all]
[untrace] cl-repl::check-input
[untrace] cl-repl::line-continue-p
[untrace] cl-repl::read-input
[untrace] cl-repl::read-input1
[untrace] cl-readline:readline
Trace collection status (7/7) [refresh]
[clear]
0 - cl-repl::read-input
| < :EXITED-NON-LOCALLY
1 `--- cl-repl::read-input1
< :EXITED-NON-LOCALLY
2 - cl-repl::read-input
| < :EXITED-NON-LOCALLY
3 `--- cl-repl::read-input1
< :EXITED-NON-LOCALLY
4 - cl-repl::read-input
| < SWANK-TRACE-DIALOG:STILL-INSIDE
5 `--- cl-repl::read-input1
| < SWANK-TRACE-DIALOG:STILL-INSIDE
6 `--- cl-readline:readline
> :PROMPT
> "[38;5;40mCL-REPL> [0m"
> :ADD-HISTORY
> T
< SWANK-TRACE-DIALOG:STILL-INSIDE
I don't see anything strange here, except of course the non-local exits. Could it be that the string with ANSI escapes is tripping up readline? I guess this maybe goes beyond lisp-land and needs a look with GDB or something, unless we can reproduce it with some kind of cl-readline test.
Same story when I try to evaluate (exit-with-prompt)
at SBCL toplevel:
0 - cl-repl::exit-with-prompt
| < :EXITED-NON-LOCALLY
1 `--- cl-readline:readline
> :PROMPT
> "Do you really want to exit ([y]/n)? "
< :EXITED-NON-LOCALLY
More testing: it appears that the system somehow is searching for libreadline.so.6.3
, eventually falling back to libreadline.so
, which on my system is a symlink to libreadline.so.8.0
. I'm guessing that my libreadline is simply too new for cl-readline
(incompatible ABI perhaps). Any opinions?
EDIT: Hm, maybe not, vindarel/cl-readline-example
works without issues.
Same here. I still don't get why, but I found that it doens't appear when cl-repl isn't loaded.
Load only cl-readline and try rl:readline
:
$ ros -Q -L sbcl -s cl-readline --eval '(rl:readline :prompt "CL-USER> ")'
CL-USER> <-- RETURN
$ # nothing happends
Load cl-repl and try rl:readline
.
$ ros -Q -L sbcl -s cl-repl --eval '(rl:readline :prompt "CL-USER> ")'
CL-USER> <-- RETURN
CORRUPTION WARNING in SBCL pid 12433(tid 0x7fff8994a380):
Memory fault at 0x4 (pc=0x722d71, sp=0x4ff510)
The integrity of this image is possibly compromised.
Continuing with fingers crossed.
debugger invoked on a SB-SYS:MEMORY-FAULT-ERROR in thread
#<THREAD "main thread" RUNNING {10005505B3}>:
Unhandled memory fault at #x4.
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-abbreviated name):
0: [CONTINUE] Ignore runtime option --eval "(ros:run '((:eval\"(ros:quicklisp)\")(:load\"/Users/fukamachi/.roswell/init.lisp\")(:system \"cl-repl\")(:eval \"(rl:readline :prompt \\\"CL-USER> \\\")\")(:quit)))".
1: [ABORT ] Skip rest of --eval and --load options.
2: Skip to toplevel READ/EVAL/PRINT loop.
3: [EXIT ] Exit SBCL (calling #'EXIT, killing the process).
("bogus stack frame")
0]
I found that (rl:register-function :redisplay #'redisplay-with-highlight)
in enable-syntax
(src/highlight.lisp) doing something bad, which is called as top-level form in src/main.lisp.
FWIW, I just tried syntax highlighting in my own SBCL REPL, and was able to narrow the problem down to redisplaying as well. It seems like it doesn’t matter what the drop-in replacement for rl:redisplay
does (I even tried it with an empty defun
), the memory fault is still triggered.
If this is a new problem, this sounds to me like rl_redisplay
now does something that _rl_update_final
depends on, and that it didn’t use to do. I’m not quite sure what it is, and the readline codebase looks a bit too messy for me to investigate this deeply.
Another fun property that I found while debugging my REPL: the error is not triggered when I run an old version of my REPL and load
a new version—then the highlighting works as expected.
I suppose rl_redisplay
does some sort of setup upon its first call that the rest of the library depends on since 8.0.
Hey! I have a solution, guys!
https://github.com/koji-kojiro/cl-repl/pull/51
Take a look on that PR.
Thanks @ryukinix! I verified that this solves the bug for me personally :)
Command line:
Traceback: