From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Freja Nordsiek Newsgroups: gmane.lisp.guile.bugs Subject: bug#24816: Bug in (rnrs io ports) procedure open-string-output-port Date: Sat, 29 Oct 2016 17:29:09 +0700 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1477737028 959 195.159.176.226 (29 Oct 2016 10:30:28 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 29 Oct 2016 10:30:28 +0000 (UTC) To: 24816@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sat Oct 29 12:30:24 2016 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1c0Qtr-0006AW-Nm for guile-bugs@m.gmane.org; Sat, 29 Oct 2016 12:30:07 +0200 Original-Received: from localhost ([::1]:53923 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0Qtu-0001Ve-CV for guile-bugs@m.gmane.org; Sat, 29 Oct 2016 06:30:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42108) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1c0Qto-0001Uc-5h for bug-guile@gnu.org; Sat, 29 Oct 2016 06:30:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1c0Qtn-00067N-CR for bug-guile@gnu.org; Sat, 29 Oct 2016 06:30:04 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:48633) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1c0Qtn-00067H-9A for bug-guile@gnu.org; Sat, 29 Oct 2016 06:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1c0Qtn-0007Xn-2u for bug-guile@gnu.org; Sat, 29 Oct 2016 06:30:03 -0400 X-Loop: help-debbugs@gnu.org 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: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.147773696228922 (code B ref -1); Sat, 29 Oct 2016 10:30:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 29 Oct 2016 10:29:22 +0000 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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 Original-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) Original-Received: by 10.28.156.213 with HTTP; Sat, 29 Oct 2016 03:29:09 -0700 (PDT) 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-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.org gmane.lisp.guile.bugs:8435 Archived-At: 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