Fix (rnrs io simple) to open file ports in textual mode.
authorMark H Weaver <mhw@netris.org>
Thu, 20 Mar 2014 03:36:46 +0000 (23:36 -0400)
committerMark H Weaver <mhw@netris.org>
Thu, 20 Mar 2014 03:36:46 +0000 (23:36 -0400)
Fixes <http://bugs.gnu.org/17044>.
Reported and diagnosed by Xin Wang <dram.wang@gmail.com>.

* module/rnrs/io/simple.scm (open-input-file, open-output-file): Pass
  missing buffer-mode argument to open-file-{input,output}-port.
  Previously, (native-transcoder) was incorrectly passed as the
  buffer-mode argument, so no transcoder was provided, thus creating a
  binary port.

module/rnrs/io/simple.scm

index 031628b..5eb396f 100644 (file)
@@ -1,6 +1,6 @@
 ;;; simple.scm --- The R6RS simple I/O library
 
-;;      Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+;;      Copyright (C) 2010, 2011, 2014 Free Software Foundation, Inc.
 ;;
 ;; This library is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU Lesser General Public
@@ -91,6 +91,7 @@
                 eof-object 
                 eof-object?
                 file-options
+                buffer-mode
                 native-transcoder
                 get-char
                 lookahead-char
       (lambda (port) (with-output-to-port port thunk))))
 
   (define (open-input-file filename)
-    (open-file-input-port filename (file-options) (native-transcoder)))
+    (open-file-input-port filename
+                          (file-options)
+                          (buffer-mode block)
+                          (native-transcoder)))
 
   (define (open-output-file filename)
-    (open-file-output-port filename (file-options) (native-transcoder)))
+    (open-file-output-port filename
+                           (file-options)
+                           (buffer-mode block)
+                           (native-transcoder)))
 
   (define close-input-port close-port)
   (define close-output-port close-port)