Discussion:
[Larceny-users] Bug - get-string-n
Ray Racine
2008-02-07 05:21:00 UTC
Permalink
There is a fence post bug in get-string-n in portio.sch. The do loop
reads a char on loop initialization and then one for count iterations.
Therefore one more then count chars are consumed in the call to
get-string-n.

See sample below. Notice '5' was skipped.


Ray

----

Process scheme finished
Larceny v0.961 "Fluoridation" (Feb 4 2008 23:49:20,
precise:Linux:unified)
larceny.heap, built on Mon Feb 4 23:53:29 EST 2008
ERR5RS mode (no libraries have been imported)
(import (rnrs))
Autoloading (rnrs)
Autoloading (rnrs enums)
Autoloading (rnrs lists)
Autoloading (rnrs syntax-case)
Autoloading (rnrs hashtables)
Autoloading (rnrs arithmetic bitwise)
Autoloading (rnrs programs)
Autoloading (rnrs files)
Autoloading (rnrs io ports)
Autoloading (larceny deprecated)
Autoloading (rnrs conditions)
Autoloading (rnrs exceptions)
Autoloading (rnrs records syntactic)
Autoloading (err5rs records procedural)
Autoloading (rnrs records procedural)
Autoloading (rnrs control)
Autoloading (rnrs sorting)
Autoloading (rnrs bytevectors)
Autoloading (rnrs unicode)
(import (rnrs io ports))
(define ip (open-string-input-port "12345678"))
(get-string-n ip 4)
"1234"
(get-string-n ip 4)
"678"


Notice '5' was skipped.
William D Clinger
2008-02-07 15:46:08 UTC
Permalink
There is a fence post bug in get-string-n in portio.sch....
Thanks for reporting this, Ray. This has been logged as
ticket #523. Two other bugs you had reported previously
have been logged as tickets #524 and #525.

Will

Continue reading on narkive:
Loading...