This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project "CMU Common Lisp".
The branch, master has been updated via c0052f5544d27980c74d5a17cd55dc2069085602 (commit) from 9e687a21f823e0c9fd5af32ab112dbe66476a9c6 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- commit c0052f5544d27980c74d5a17cd55dc2069085602 Author: Raymond Toy toy.raymond@gmail.com Date: Sat Aug 9 12:53:57 2014 -0700
Fix ticket:105 by not flaming out on a closed stream.
* code/reader.lisp: * The READER-ERROR condition tries to be helpful and print out the position of where the error occurred using FILE-POSITION. But FILE-POSITION flames out when the stream is closed, so check for a closed stream before calling FILE-POSITION
* tests/trac.lisp: * Add test from the bug report.
* general-info/release-20f.txt: * Update.
diff --git a/src/code/reader.lisp b/src/code/reader.lisp index b06230c..996b1f3 100644 --- a/src/code/reader.lisp +++ b/src/code/reader.lisp @@ -62,8 +62,11 @@ (reader-error-format-arguments condition)) nil error-stream (file-position error-stream))) + (format t "open-stream-p ~A~%" (open-stream-p error-stream)) (format stream (intl:gettext "Reader error ~@[at ~D ~]on ~S:~%~?") - (file-position error-stream) error-stream + (and (open-stream-p error-stream) + (file-position error-stream)) + error-stream (reader-error-format-control condition) (reader-error-format-arguments condition))))))
diff --git a/src/general-info/release-20f.txt b/src/general-info/release-20f.txt index b6ce0d5..388ca02 100644 --- a/src/general-info/release-20f.txt +++ b/src/general-info/release-20f.txt @@ -109,6 +109,7 @@ New in this release: * Ticket #101, item 1 fixed. * Ticket #105, fixed. * Ticket #84 fixed on x86. + * Ticket #105 fixed.
* Other changes:
diff --git a/tests/trac.lisp b/tests/trac.lisp index 9a02189..571b069 100644 --- a/tests/trac.lisp +++ b/tests/trac.lisp @@ -366,4 +366,33 @@ (assert-error 'reader-error (read-from-string ".1e-45")) (assert-error 'reader-error (read-from-string "1d-324")) (assert-error 'reader-error (read-from-string "1w-324"))) + +(defun read-string-fn (str) + (handler-case + (let ((acc nil)) + (with-input-from-string + (stream str) + (loop do + (let* ((eof-marker (cons nil nil)) + (elem (read stream nil eof-marker))) + (if (eq elem eof-marker) + (loop-finish) + (push elem acc))))) + (setq acc (nreverse acc)) + (values :OK acc)) + (error (condition) + (return-from read-string-fn + (values :ERROR (format nil "~A" condition)))) + (storage-condition (condition) + (return-from read-string-fn + (values :STORAGE (format nil "~A" condition)))))) + +(define-test trac.105 + (:tag :trac) + (assert-equal (values :ERROR + "Reader error on #<String-Input Stream>: +No dispatch function defined for #\W.") + (read-string-fn "#\wtf"))) + +
\ No newline at end of file
-----------------------------------------------------------------------
Summary of changes: src/code/reader.lisp | 5 ++++- src/general-info/release-20f.txt | 1 + tests/trac.lisp | 29 +++++++++++++++++++++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-)
hooks/post-receive