Subject: bug#17466: unexpected bytevector contents with get-bytevector-n

From: J Kalbhenn <[email-masked]>
Date: Sun, 11 May 2014 13:00:23 +0200

concerning the following code example
--
(import (rnrs io ports) (ice-9 pretty-print))
(define (problem-part port) (pretty-print (get-bytevector-n port 4096)))

(let loop ((count 100))
  (if (> count 0)
    (begin (call-with-input-string "22222222222222222222" problem-part)
(loop (- count 1)))))
__

when i run it i get output with portions like this
--
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 16 224 240 0 0 0 0 0 50 50 50 50)
#vu8(50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50 50)
--

and i would expect the bytevector to always be the same.

this first occurred to me in a more complicated scenario where:
  - the input port is a file-port
  - pretty-print was used at first and then display instead, but the
problem persisted with a much lower frequency

system info
  guile 2.0.11
  linux 3.14.2-1-ARCH x86_64