sbcl wrong behavior in Windows terminal
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SBCL |
Fix Released
|
Medium
|
Unassigned |
Bug Description
Hi there,
I *think* sbcl does not properly deal with the new-line or line-endings character. In windows terminal, I mean ``cmd'' on Windows platform, You can reproduce the issue with the following code:
```
* (defun a) ;with a return
debugger invoked on a SB-KERNEL:
#<THREAD "main thread" RUNNING {1002954623}>:
error while parsing arguments to DEFMACRO DEFUN:
too few elements in
(A)
to satisfy lambda list
(
at least 2 expected, but got 1
Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.
restarts (invokable by number or by possibly-
0: [ABORT] Exit debugger, returning to top level.
```
there is still another line not be printed, at this point, press the return, the line will appear:
```
(SB-C::
0]
```
There is another case I *think* that it may related to the same thing. Below is the lisp code:
```
(defun read-with-default (prompt default)
(format t "~a [~a]: " prompt default)
(terpri)
(let ((response (read-line)))
(if (string= response "") default response)))
(let ((a)
(b))
(setf a (read-with-default "a > " "a"))
(setf b (read-with-default "b > " "b")))
```
In Windows ``cmd'', the output is like:
```
* (defun read-with-default (prompt default)
(format t "~a [~a]: " prompt default)
(terpri)
(let ((response (read-line)))
(if (string= response "") default response)))
READ-WITH-DEFAULT
* (let ((a)
(b))
(setf a (read-with-default "a > " "a"))
(setf b (read-with-default "b > " "b")))
a > [a]:
b > [b]:
"b"
"\"b\"
*
```
You may notice that the (setf a (read-with-default "a > " "a")) dose not give chance to user to input anything. and the (setf a (read-with-default "a > " "a")) response to user, but does not give correct echo, it should be "\"b\""
The sbcl works well on MYSY2 terminal. Thus, it may be a Windows terminal specific issue.
The version of sbcl I used.
C:\Users\
SBCL 1.3.12
The system I used is:
Microsoft Windows 10 Professional, ver. 10.0.14393
Best regards,
Jinsong
Changed in sbcl: | |
status: | Fix Committed → Fix Released |
This is because clear-input tries to read from the stream.
This is because listen returns t.
This is because it claims to do something special with console handles and claims that the first two bits of console handles #b11, which is untrue.
This is because the whole OS layer is a a mess.