1.0.17.34: Fix bug: READ-LINE did not return T for the last line of ANSI-STREAM.
authorAlexey Dejneka <adejneka@comail.ru>
Sun, 15 Jun 2008 05:28:24 +0000 (05:28 +0000)
committerAlexey Dejneka <adejneka@comail.ru>
Sun, 15 Jun 2008 05:28:24 +0000 (05:28 +0000)
           Reported by Yoshinori Tahara.

NEWS
src/code/stream.lisp
tests/stream.impure.lisp
version.lisp-expr

diff --git a/NEWS b/NEWS
index 5fe425f..a84ea06 100644 (file)
--- 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)
index 14647db..e2bb25d 100644 (file)
                               :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%))
index d01b63e..e6cb01c 100644 (file)
   (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))))))
+\f
 ;;; success
index ce46f54..1d46a77 100644 (file)
@@ -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"