From 240d3c4a81b02196176795b82c263fed8dd3ddfe Mon Sep 17 00:00:00 2001 From: Alexey Dejneka Date: Sun, 15 Jun 2008 05:28:24 +0000 Subject: [PATCH] 1.0.17.34: Fix bug: READ-LINE did not return T for the last line of ANSI-STREAM. Reported by Yoshinori Tahara. --- NEWS | 2 ++ src/code/stream.lisp | 2 +- tests/stream.impure.lisp | 13 ++++++++++++- version.lisp-expr | 2 +- 4 files changed, 16 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 5fe425f..a84ea06 100644 --- a/NEWS +++ b/NEWS @@ -25,6 +25,8 @@ changes in sbcl-1.0.18 relative to 1.0.17: in sb-bsd-sockets. * bug fix: if COMPILE-FILE aborts due to an unwind, the partial fasl is now deleted. (reported by Attila Lendvai) + * bug fix: READ-LINE always returned NIL for the last line in files. + (reported by Yoshinori Tahara) * fixed some bugs revealed by Paul Dietz' test suite: ** NIL is a valid function name (regression at 1.0.13.38) ** FILL on lists was missing its return value (regression at 1.0.12.27) diff --git a/src/code/stream.lisp b/src/code/stream.lisp index 14647db..e2bb25d 100644 --- a/src/code/stream.lisp +++ b/src/code/stream.lisp @@ -268,7 +268,7 @@ :start2 %frc-index% :end2 pos) (setf %frc-index% (1+ pos))) (done-with-fast-read-char) - (return-from ansi-stream-read-line-from-frc-buffer res))) + (return-from ansi-stream-read-line-from-frc-buffer (values res (null pos))))) (add-chunk () (let* ((end (length %frc-buffer%)) (len (- end %frc-index%)) diff --git a/tests/stream.impure.lisp b/tests/stream.impure.lisp index d01b63e..e6cb01c 100644 --- a/tests/stream.impure.lisp +++ b/tests/stream.impure.lisp @@ -486,5 +486,16 @@ (with-open-stream (stream (make-synonym-stream '*stream*)) (assert (input-stream-p stream)))) - +;;; READ-LINE on ANSI-STREAM did not return T for the last line +;;; (reported by Yoshinori Tahara) +(let ((pathname "test-read-line-eol")) + (with-open-file (out pathname :direction :output :if-exists :supersede) + (format out "a~%b")) + (let ((result (with-open-file (in pathname) + (list (multiple-value-list (read-line in nil nil)) + (multiple-value-list (read-line in nil nil)) + (multiple-value-list (read-line in nil nil)))))) + (delete-file pathname) + (assert (equal result '(("a" nil) ("b" t) (nil t)))))) + ;;; success diff --git a/version.lisp-expr b/version.lisp-expr index ce46f54..1d46a77 100644 --- a/version.lisp-expr +++ b/version.lisp-expr @@ -17,4 +17,4 @@ ;;; checkins which aren't released. (And occasionally for internal ;;; versions, especially for internal versions off the main CVS ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".) -"1.0.17.33" +"1.0.17.34" -- 1.7.10.4