unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#32329: call-with-input-file and call-with-output-file should use textual ports
@ 2018-07-31  7:14 Göran Weinholt
  2018-08-02 14:44 ` Mark H Weaver
  0 siblings, 1 reply; 2+ messages in thread
From: Göran Weinholt @ 2018-07-31  7:14 UTC (permalink / raw)
  To: 32329

Hello schemers,

the call-with-input-file and call-with-output-file procedures in (rnrs
io simple) should open textual ports. In Guile 2.2.4, they open binary
ports:

  (define (call-with-input-file filename proc)
    (call-with-port (open-file-input-port filename) proc))

  (define (call-with-output-file filename proc)
    (call-with-port (open-file-output-port filename) proc))

Changing the inner calls to open-input-file and open-output-file is
sufficient to fix this bug.

A consequence of using binary ports here is that the I/O is not
transcoded, so UTF-8 data is corrupted.

-- 
Göran Weinholt
Debian developer
73 de SA6CJK





^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#32329: call-with-input-file and call-with-output-file should use textual ports
  2018-07-31  7:14 bug#32329: call-with-input-file and call-with-output-file should use textual ports Göran Weinholt
@ 2018-08-02 14:44 ` Mark H Weaver
  0 siblings, 0 replies; 2+ messages in thread
From: Mark H Weaver @ 2018-08-02 14:44 UTC (permalink / raw)
  To: Göran Weinholt; +Cc: 32329-done

Hi Göran,

Göran Weinholt <goran@weinholt.se> writes:

> the call-with-input-file and call-with-output-file procedures in (rnrs
> io simple) should open textual ports. In Guile 2.2.4, they open binary
> ports:
>
>   (define (call-with-input-file filename proc)
>     (call-with-port (open-file-input-port filename) proc))
>
>   (define (call-with-output-file filename proc)
>     (call-with-port (open-file-output-port filename) proc))
>
> Changing the inner calls to open-input-file and open-output-file is
> sufficient to fix this bug.
>
> A consequence of using binary ports here is that the I/O is not
> transcoded, so UTF-8 data is corrupted.

Fixed in commit 4c91de3e45e7c98d5b7c484509fe5c59bd70f9fd on the
'stable-2.2' branch.  Thanks!

       Mark





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-08-02 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-31  7:14 bug#32329: call-with-input-file and call-with-output-file should use textual ports Göran Weinholt
2018-08-02 14:44 ` Mark H Weaver

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).