GNU bug report logs - #24816
Bug in (rnrs io ports) procedure open-string-output-port

Previous Next

Package: guile;

Reported by: Freja Nordsiek <fnordsie <at> gmail.com>

Date: Sat, 29 Oct 2016 10:30:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 24816 in the body.
You can then email your comments to 24816 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#24816; Package guile. (Sat, 29 Oct 2016 10:30:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Freja Nordsiek <fnordsie <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sat, 29 Oct 2016 10:30:03 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Freja Nordsiek <fnordsie <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: Bug in (rnrs io ports) procedure open-string-output-port
Date: Sat, 29 Oct 2016 17:29:09 +0700
The "open-string-output-port" procedure in (rnrs io ports) returns two
values, a string port and a thunk that returns a string of the
characters written to the port so far. In the R6RS standard documents,
the reading procedure is destructive, in that it clears all the
characters written to the port so far (though, it does not close it,
so it can still be used). However, in Guile 2.1.4, the characters are
not cleared and so running the thunk again immediately afterwards will
produce the same output, which is a bug.

This can be tested running the following script


    (import (rnrs base (6))
            (rnrs io ports (6))
            (rnrs io simple (6)))

    (let-values (((p get-output) (open-string-output-port)))
      (display "hello" p)
      (flush-output-port p)
      (let ((out-first (get-output)))
        (let ((out-second (get-output)))
          (display (string-append "Follows R6RS: "
                                  (if (string=? out-first out-second)
                                      "no"
                                      "yes")))
          (newline)
          (display (string-append "out-first: " out-first))
          (newline)
          (display (string-append "out-second: " out-second))
          (newline))))


which produces the following output in guile


    Follows R6RS: no
    out-first: hello
    out-second: hello


when it should output



    Follows R6RS: yes
    out-first: hello
    out-second:


instead.




Freja Nordsiek




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Wed, 01 Mar 2017 13:28:02 GMT) Full text and rfc822 format available.

Notification sent to Freja Nordsiek <fnordsie <at> gmail.com>:
bug acknowledged by developer. (Wed, 01 Mar 2017 13:28:02 GMT) Full text and rfc822 format available.

Message #10 received at 24816-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Freja Nordsiek <fnordsie <at> gmail.com>
Cc: 24816-done <at> debbugs.gnu.org
Subject: Re: bug#24816: Bug in (rnrs io ports) procedure
 open-string-output-port
Date: Wed, 01 Mar 2017 14:26:50 +0100
On Sat 29 Oct 2016 12:29, Freja Nordsiek <fnordsie <at> gmail.com> writes:

> The "open-string-output-port" procedure in (rnrs io ports) returns two
> values, a string port and a thunk that returns a string of the
> characters written to the port so far. In the R6RS standard documents,
> the reading procedure is destructive, in that it clears all the
> characters written to the port so far (though, it does not close it,
> so it can still be used). However, in Guile 2.1.4, the characters are
> not cleared and so running the thunk again immediately afterwards will
> produce the same output, which is a bug.

Thanks for the report; fixed in git.  Cheers :)

Andy




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 30 Mar 2017 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 8 years and 79 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.