Calling port-eof? at eof empties bytevector input ports

Bug #433574 reported by Gwen Weinholt
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ikarus Scheme
Fix Committed
Medium
Abdulaziz Ghuloum

Bug Description

Ikarus Scheme version 0.0.4-rc1+, 64-bit (revision 1857, build 2009-09-13)
Copyright (c) 2006-2009 Abdulaziz Ghuloum

> (define p (open-bytevector-input-port #vu8(42)))
> (port-eof? p)
#f
> (get-u8 p)
42
> (set-port-position! p 0)
> (get-u8 p)
42
> (port-eof? p)
#t
> (set-port-position! p 0)
> (get-u8 p)
#!eof
>

The last call to get-u8 should also return 42, but it seems the port's data was obliterated by the last call to port-eof?.

Related branches

Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

Fixed in 1857. Thanks.

Changed in ikarus:
assignee: nobody → Abdulaziz Ghuloum (aghuloum)
importance: Undecided → Medium
status: New → Fix Committed
Revision history for this message
Abdulaziz Ghuloum (aghuloum) wrote :

BTW, string input ports exhibited the same bug and it was fixed too.

$ ikarus
Ikarus Scheme version 0.0.4-rc1+, 64-bit (revision 1856, build 2009-09-21)
Copyright (c) 2006-2009 Abdulaziz Ghuloum

> (define p (open-bytevector-input-port #vu8(42)))
> (port-position p)
0
> (port-eof? p)
#f
> (get-u8 p)
42
> (set-port-position! p 0)
> (get-u8 p)
42
> (port-eof? p)
#t
> (set-port-position! p 0)
> (get-u8 p)
42
> (port-eof? p)
#t
> (define p (open-string-input-port "a"))
> (port-position p)
0
> (port-eof? p)
#f
> (get-char p)
#\a
> (set-port-position! p 0)
> (get-char p)
#\a
> (port-eof? p)
#t
> (set-port-position! p 0)
> (get-char p)
#\a
> (port-eof? p)
#t

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.