From unknown Sun Jun 22 00:46:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24816: Bug in (rnrs io ports) procedure open-string-output-port Resent-From: Freja Nordsiek Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 29 Oct 2016 10:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24816 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: 24816@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.147773696228922 (code B ref -1); Sat, 29 Oct 2016 10:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 29 Oct 2016 10:29:22 +0000 Received: from localhost ([127.0.0.1]:35796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qt8-0007WQ-8b for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qt5-0007W7-VI for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0Qt0-0005jj-1h for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42428) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c0Qsz-0005jT-UI for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0Qsy-0001L2-Vc for bug-guile@gnu.org; Sat, 29 Oct 2016 06:29:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0Qsy-0005iv-45 for bug-guile@gnu.org; Sat, 29 Oct 2016 06:29:12 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:37570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c0Qsx-0005ih-Tg for bug-guile@gnu.org; Sat, 29 Oct 2016 06:29:12 -0400 Received: by mail-wm0-x22b.google.com with SMTP id 140so110596979wmv.0 for ; Sat, 29 Oct 2016 03:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=FeLBDMplTNN58tfdtw6drBVodIP9WWx8hgdP/z62seg=; b=gmeUlCsNmHqTBiMXdbHr/1CCRzibpd19j22KGYhABfYRQcj+zielkMLSDdp8s9Jd5V wmednpjvdvKnGTUDpqi8OMGhZ5aQyQA7/lGYe5V/cObe7pFFHTl2TTDKun8Apb0AyDdu cN+i3FDOrDt0Co51PKiJc22AORVHSYgw1lFywGFJzhkBY+XBaIQg2bgnwQKzbVFrsBo6 aXZpUXbgr/kGWXvq1IgNsu+6tPhKa8mjPOgh5qlFT4UFFJs6lixrBQM+th/XDVPzc3WP t733860wOIAOrXfSTdaM0MxAx9G2mQOtNSaQ2R6EUpBF9LYJEd4wMYBw+dGZ5d5ysB4n 4PUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FeLBDMplTNN58tfdtw6drBVodIP9WWx8hgdP/z62seg=; b=ZsdVYNR+JHXqCRZgX2T8WM1JcJJsm/7kMkoJTpgDZ023Ot0AdaJjJJ3NS92pX0p6ZM PwnhVasS3LkOvVbYfydBP1PlkdHgmB6rVZYjnNOW79LA+NuEBmq2YMw2uzAYDKF8r3uJ k6FFRQy/BjLiiKUi2mCGJ8q1XItYG9Q+Kv92f1bbQt/HbWmf5WX/vXFsQACTKB5cZdOG USjGOlKFfxJQaZKEijDsjtVfwBcCqRxxqyWY0crrflAMuu3V0CmTLtiHNpwPeVEtr0CX qPxn/dqXql8Yi8yEpiQl7mU/zOln3vR+QHSprx/Y3akegMzWfwAR/cRRNBosx1rGFGKK 4GVg== X-Gm-Message-State: ABUngvei1wV0qhgdNeVwk/KaGtxhBOkcHmkKcrpt+p+IbXXaxWkrfme6Nj+5QdkOJYeFRWOHfdnkNQqmvHR5IQ== X-Received: by 10.28.210.195 with SMTP id j186mr2981103wmg.30.1477736950240; Sat, 29 Oct 2016 03:29:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.156.213 with HTTP; Sat, 29 Oct 2016 03:29:09 -0700 (PDT) From: Freja Nordsiek Date: Sat, 29 Oct 2016 17:29:09 +0700 Message-ID: Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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 From unknown Sun Jun 22 00:46:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Freja Nordsiek Subject: bug#24816: closed (Re: bug#24816: Bug in (rnrs io ports) procedure open-string-output-port) Message-ID: References: <87shmxgmat.fsf@pobox.com> X-Gnu-PR-Message: they-closed 24816 X-Gnu-PR-Package: guile Reply-To: 24816@debbugs.gnu.org Date: Wed, 01 Mar 2017 13:28:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1488374882-28731-1" This is a multi-part message in MIME format... ------------=_1488374882-28731-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24816: Bug in (rnrs io ports) procedure open-string-output-port which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24816@debbugs.gnu.org. --=20 24816: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24816 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1488374882-28731-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24816-done) by debbugs.gnu.org; 1 Mar 2017 13:27:03 +0000 Received: from localhost ([127.0.0.1]:32975 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cj4HW-0007Rx-OR for submit@debbugs.gnu.org; Wed, 01 Mar 2017 08:27:02 -0500 Received: from pb-sasl2.pobox.com ([64.147.108.67]:62287 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cj4HU-0007RY-Ta for 24816-done@debbugs.gnu.org; Wed, 01 Mar 2017 08:27:01 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 66E9F657C5; Wed, 1 Mar 2017 08:26:58 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=UscbAQcnleUjy/G1kLfpnrqCNGA=; b=l5BJus LoI60vGdJmF1Bz9ElZJcB+J7sToez/QJLfu6RSWrLSMa+6rWrv4TeIxGsevJOSSg lcPAdqt/lZ2xaWpQU+1a0cpdvxUGQGWV71PjfTEkYT8urSHsRIAB6SOwtOAxQJ0c g4WPSu/sBRQPKWK5I0/Pb+DtQjKVYG1xS+uyE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=JbcIDglE0XwIYhSmnFeemDxrhSxXHJVV 09eLp9vfG7fDj3bnsmrxQaJZqfWirg5z9xTQ/OP549g8QatQZjpNyU7Ujn8I/lmq nX37dXywmTsDsYupfDnQvWk+qjf/lYOeihTN6oDeMHLjw8wFWLgtst9R1rpVzihO sQNUy8wStLI= Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 5055F657C3; Wed, 1 Mar 2017 08:26:58 -0500 (EST) Received: from clucks (unknown [109.190.228.233]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id 66D83657C2; Wed, 1 Mar 2017 08:26:57 -0500 (EST) From: Andy Wingo To: Freja Nordsiek Subject: Re: bug#24816: Bug in (rnrs io ports) procedure open-string-output-port References: Date: Wed, 01 Mar 2017 14:26:50 +0100 In-Reply-To: (Freja Nordsiek's message of "Sat, 29 Oct 2016 17:29:09 +0700") Message-ID: <87shmxgmat.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Pobox-Relay-ID: BE7FAD96-FE82-11E6-BC0A-85AB91A0D1B0-02397024!pb-sasl2.pobox.com X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 24816-done Cc: 24816-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On Sat 29 Oct 2016 12:29, Freja Nordsiek 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 ------------=_1488374882-28731-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 29 Oct 2016 10:29:22 +0000 Received: from localhost ([127.0.0.1]:35796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qt8-0007WQ-8b for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:22 -0400 Received: from eggs.gnu.org ([208.118.235.92]:51024) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qt5-0007W7-VI for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0Qt0-0005jj-1h for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:14 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:42428) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1c0Qsz-0005jT-UI for submit@debbugs.gnu.org; Sat, 29 Oct 2016 06:29:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41989) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0Qsy-0001L2-Vc for bug-guile@gnu.org; Sat, 29 Oct 2016 06:29:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0Qsy-0005iv-45 for bug-guile@gnu.org; Sat, 29 Oct 2016 06:29:12 -0400 Received: from mail-wm0-x22b.google.com ([2a00:1450:400c:c09::22b]:37570) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c0Qsx-0005ih-Tg for bug-guile@gnu.org; Sat, 29 Oct 2016 06:29:12 -0400 Received: by mail-wm0-x22b.google.com with SMTP id 140so110596979wmv.0 for ; Sat, 29 Oct 2016 03:29:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to; bh=FeLBDMplTNN58tfdtw6drBVodIP9WWx8hgdP/z62seg=; b=gmeUlCsNmHqTBiMXdbHr/1CCRzibpd19j22KGYhABfYRQcj+zielkMLSDdp8s9Jd5V wmednpjvdvKnGTUDpqi8OMGhZ5aQyQA7/lGYe5V/cObe7pFFHTl2TTDKun8Apb0AyDdu cN+i3FDOrDt0Co51PKiJc22AORVHSYgw1lFywGFJzhkBY+XBaIQg2bgnwQKzbVFrsBo6 aXZpUXbgr/kGWXvq1IgNsu+6tPhKa8mjPOgh5qlFT4UFFJs6lixrBQM+th/XDVPzc3WP t733860wOIAOrXfSTdaM0MxAx9G2mQOtNSaQ2R6EUpBF9LYJEd4wMYBw+dGZ5d5ysB4n 4PUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=FeLBDMplTNN58tfdtw6drBVodIP9WWx8hgdP/z62seg=; b=ZsdVYNR+JHXqCRZgX2T8WM1JcJJsm/7kMkoJTpgDZ023Ot0AdaJjJJ3NS92pX0p6ZM PwnhVasS3LkOvVbYfydBP1PlkdHgmB6rVZYjnNOW79LA+NuEBmq2YMw2uzAYDKF8r3uJ k6FFRQy/BjLiiKUi2mCGJ8q1XItYG9Q+Kv92f1bbQt/HbWmf5WX/vXFsQACTKB5cZdOG USjGOlKFfxJQaZKEijDsjtVfwBcCqRxxqyWY0crrflAMuu3V0CmTLtiHNpwPeVEtr0CX qPxn/dqXql8Yi8yEpiQl7mU/zOln3vR+QHSprx/Y3akegMzWfwAR/cRRNBosx1rGFGKK 4GVg== X-Gm-Message-State: ABUngvei1wV0qhgdNeVwk/KaGtxhBOkcHmkKcrpt+p+IbXXaxWkrfme6Nj+5QdkOJYeFRWOHfdnkNQqmvHR5IQ== X-Received: by 10.28.210.195 with SMTP id j186mr2981103wmg.30.1477736950240; Sat, 29 Oct 2016 03:29:10 -0700 (PDT) MIME-Version: 1.0 Received: by 10.28.156.213 with HTTP; Sat, 29 Oct 2016 03:29:09 -0700 (PDT) From: Freja Nordsiek Date: Sat, 29 Oct 2016 17:29:09 +0700 Message-ID: Subject: Bug in (rnrs io ports) procedure open-string-output-port To: bug-guile@gnu.org Content-Type: text/plain; charset=UTF-8 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) 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 ------------=_1488374882-28731-1--