From: Mark H Weaver <mhw@netris.org>
To: David Kastrup <dak@gnu.org>
Cc: 20302-done@debbugs.gnu.org
Subject: bug#20302: peek-char messes up file position on binary string ports
Date: Wed, 04 Nov 2015 16:12:38 -0500 [thread overview]
Message-ID: <87k2pxzcxl.fsf@netris.org> (raw)
In-Reply-To: <87oahfoj8p.fsf@netris.org> (Mark H. Weaver's message of "Sun, 06 Sep 2015 07:55:02 -0400")
Mark H Weaver <mhw@netris.org> writes:
> Mark H Weaver <mhw@netris.org> writes:
>
>> David Kastrup <dak@gnu.org> writes:
>>
>>> (use-modules (rnrs bytevectors) (rnrs io ports))
>>> (let ((port (open-bytevector-input-port
>>> (string->utf8 "Blablabla\nBlablabla\n"))))
>>> (seek port 13 SEEK_SET)
>>> (format #t "~c ~d\n" (peek-char port)
>>> (ftell port)))
>>> ;; Outputs b 3 but should output b 13
>>>
>>> This is using
>>> guile (GNU Guile) 2.0.11
>>> Packaged by Debian (2.0.11-deb+1-1)
>>
>> Ouch :-(
>>
>> The problem is that r6rs-ports.c:bip_seek assumes that
>> c_port->read_{buf,pos,end} point to the original bytevector, and fail to
>> handle the case where it points to a "putback" buffer.
>>
>> Note that (ftell port) is equivalent to (seek port 0 SEEK_CUR).
>
> I've attached a preliminary patch set to fix this bug and some others.
I believe this is now fixed on the stable-2.0 branch, commit
448eb30e3d9e998e97a5d51875f861c9f6c1101c. I'm closing this bug now.
Thanks,
Mark
next prev parent reply other threads:[~2015-11-04 21:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-11 11:48 bug#20302: peek-char messes up file position on binary string ports David Kastrup
2015-04-17 5:29 ` Mark H Weaver
2015-09-06 11:55 ` Mark H Weaver
2015-11-04 21:12 ` Mark H Weaver [this message]
[not found] ` <handler.20302.B.142875290514957.ack@debbugs.gnu.org>
2015-08-31 9:09 ` bug#20302: Acknowledgement (peek-char messes up file position on binary string ports) David Kastrup
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k2pxzcxl.fsf@netris.org \
--to=mhw@netris.org \
--cc=20302-done@debbugs.gnu.org \
--cc=dak@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).