[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20302: peek-char messes up file position on binary string ports
From: |
Mark H Weaver |
Subject: |
bug#20302: peek-char messes up file position on binary string ports |
Date: |
Wed, 04 Nov 2015 16:12:38 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) |
Mark H Weaver <address@hidden> writes:
> Mark H Weaver <address@hidden> writes:
>
>> David Kastrup <address@hidden> 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
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- bug#20302: peek-char messes up file position on binary string ports,
Mark H Weaver <=