From 7ea8aa1c9a049cbfb02f96fae84a80ed8f550d70 Mon Sep 17 00:00:00 2001 From: Nikodemus Siivola Date: Thu, 29 Mar 2007 18:08:47 +0000 Subject: [PATCH] 1.0.4.9: writing bignum characters onto a single line * FD-STREAM-CHAR-POS can run into bignums. It might be prudent to stop incrementing it for stupendously long lines, but this will do for now. --- NEWS | 2 ++ src/code/fd-stream.lisp | 5 +++-- tests/stream.impure.lisp | 21 +++++++++++++++++++++ version.lisp-expr | 2 +- 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index bbe8edc..6efc3c2 100644 --- a/NEWS +++ b/NEWS @@ -10,6 +10,8 @@ changes in sbcl-1.0.5 relative to sbcl-1.0.4: documented as unsafe. * documentation: SB-SYS:WITHOUT-GCING has been documented as unsafe in multithreaded application code. + * bug fix: number of characters that can be written onto a single + line in a file is unlimited. * bug fix: GC deadlocks from asynchronous interrupts has been fixed by disabling interrupts for the duration of any SB-SYS:WITHOUT-GCING section. diff --git a/src/code/fd-stream.lisp b/src/code/fd-stream.lisp index 567c5b4..1162446 100644 --- a/src/code/fd-stream.lisp +++ b/src/code/fd-stream.lisp @@ -77,8 +77,9 @@ ;; sources where input and output aren't related). non-NIL means ;; don't clear input buffer. (dual-channel-p nil) - ;; character position (if known) - (char-pos nil :type (or index null)) + ;; character position if known -- this may run into bignums, but + ;; we probably should flip it into null then for efficiency's sake... + (char-pos nil :type (or unsigned-byte null)) ;; T if input is waiting on FD. :EOF if we hit EOF. (listen nil :type (member nil t :eof)) diff --git a/tests/stream.impure.lisp b/tests/stream.impure.lisp index 4a250ac..f7af263 100644 --- a/tests/stream.impure.lisp +++ b/tests/stream.impure.lisp @@ -412,4 +412,25 @@ (assert (subtypep (type-error-expected-type condition) '(unsigned-byte 8))))))) +;;; writing looong lines +(defun write-n-chars (n stream) + (format t "~&/writing ~D chars on a single line~%" n) + (finish-output t) + (loop repeat n + do (write-char #\x stream)) + (terpri stream) + n) + +(let ((test "long-lines-write-test.tmp")) + (unwind-protect + (with-open-file (f test + :direction :output + :external-format :ascii + :element-type 'character + :if-does-not-exist :create + :if-exists :supersede) + (write-n-chars (+ most-positive-fixnum 7) f)) + (when (probe-file test) + (delete-file test)))) + ;;; success diff --git a/version.lisp-expr b/version.lisp-expr index 70717c9..85d8093 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.4.8" +"1.0.4.9" -- 1.7.10.4