From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#12216: peek-char incorrectly *CONSUMES* eof Date: Thu, 07 Mar 2013 22:32:38 +0100 Message-ID: <87ip52ew09.fsf@pobox.com> References: <87sj49vld2.fsf@pobox.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1362692016 26054 80.91.229.3 (7 Mar 2013 21:33:36 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 7 Mar 2013 21:33:36 +0000 (UTC) Cc: almkglor , 12216 <12216@debbugs.gnu.org> To: dwheeler@dwheeler.com Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Thu Mar 07 22:34:00 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UDiRo-0006S2-9D for guile-bugs@m.gmane.org; Thu, 07 Mar 2013 22:33:56 +0100 Original-Received: from localhost ([::1]:48146 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDiRS-0004wF-AT for guile-bugs@m.gmane.org; Thu, 07 Mar 2013 16:33:34 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:50589) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDiRO-0004sD-W0 for bug-guile@gnu.org; Thu, 07 Mar 2013 16:33:32 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UDiRN-0006AT-8l for bug-guile@gnu.org; Thu, 07 Mar 2013 16:33:30 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:33071) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UDiRN-0006AN-46 for bug-guile@gnu.org; Thu, 07 Mar 2013 16:33:29 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UDiRu-0003Ni-3D for bug-guile@gnu.org; Thu, 07 Mar 2013 16:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Thu, 07 Mar 2013 21:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12216 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 12216-submit@debbugs.gnu.org id=B12216.136269199812942 (code B ref 12216); Thu, 07 Mar 2013 21:34:02 +0000 Original-Received: (at 12216) by debbugs.gnu.org; 7 Mar 2013 21:33:18 +0000 Original-Received: from localhost ([127.0.0.1]:37178 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDiRB-0003Mg-DL for submit@debbugs.gnu.org; Thu, 07 Mar 2013 16:33:17 -0500 Original-Received: from a-pb-sasl-quonix.pobox.com ([208.72.237.25]:44629 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UDiR9-0003MZ-UO for 12216@debbugs.gnu.org; Thu, 07 Mar 2013 16:33:16 -0500 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 5FBEDB0D3; Thu, 7 Mar 2013 16:32:41 -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=eqd0URu1G1DW4s4/AEsuHxa8C6Q=; b=HtfBiO LYhGb7DIheMzFTg4YsET2LT6AZQhnofZzDmAogrbg8ckQCmr5gDauhfIamIvIewj KdAzmBTVg2ZRYcYPCPQHx1gQ9syCI1oQrQH87l963liOLx4kRBNbgp1yFQDKBWUH NJ8zIeErNj8X3yiLrfB/S1lLKAHV+7TB8CPtI= 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=wd2B+r8IbUdv2kKQkH2f6590Lz0PRvUf WMfMddzV/rc+0GyTxdhBfqcJEhjiETYnDbSPX0fybYarlx3+6fWgF8eTMQcxwm9E XGTZUkq0dXh+7WrXNNL2Dm6RVxbKZEMglI3kL2ryW5/lIWDqPCrrqTgw/O1TPUnN y7lXJREglJI= Original-Received: from a-pb-sasl-quonix.pobox.com (unknown [127.0.0.1]) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTP id 57846B0D2; Thu, 7 Mar 2013 16:32:41 -0500 (EST) Original-Received: from badger (unknown [88.160.190.192]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by a-pb-sasl-quonix.pobox.com (Postfix) with ESMTPSA id C8191B0D1; Thu, 7 Mar 2013 16:32:40 -0500 (EST) In-Reply-To: (David A. Wheeler's message of "Tue, 05 Mar 2013 14:17:31 -0500 (EST)") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2 (gnu/linux) X-Pobox-Relay-ID: 8A35FB7E-876E-11E2-B4C6-59240E5B5709-02397024!a-pb-sasl-quonix.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.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-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6874 Archived-At: On Tue 05 Mar 2013 20:17, "David A. Wheeler" writes: > I reported: >> > Guile's peek-char has a bug; it incorrectly *consumes* eof instead of >> > just reporting it. > > Andy Wingo replied: >> I have the feeling that for interactive use, if you expect to read a EOF >> from a port and then continue, you have to not use peek-char. You need >> to handle your own lookahead buffer. I know it's not a great answer, >> but I can't think of anything else that makes sense. > > We don't want to read an EOF and then continue. > We peek-char to not *CONSUME* an interactive EOF. I understand what it is you want. But I don't know of any sane way to implement it. Given that it is an edge case -- peek-char on an interactive port -- I think the thing to do is to document this inconsistency, and for you (in your code) to implement some sort of abstraction that does not use peek-char. That is to say, use read-char, and do unread-char as necessary. Or keep your own buffer around. I know it isn't nice, but I don't know how to do anything better. Andy -- http://wingolog.org/