GNU bug report logs -
#79619
repl versus compiler discrepancy in handling of bytevectors
Previous Next
To reply to this bug, email your comments to 79619 AT debbugs.gnu.org.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-guile <at> gnu.org:
bug#79619; Package
guile.
(Sun, 12 Oct 2025 22:24:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
"Jakob L. Kreuze" <zerodaysfordays <at> sdf.org>:
New bug report received and forwarded. Copy sent to
bug-guile <at> gnu.org.
(Sun, 12 Oct 2025 22:24:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
I have program which works fine when compiled, but when pasted into a
REPL gives the following error message:
While compiling expression:
In procedure bytevector-copy!: Wrong type argument in position 3
(expecting mutable bytevector): #vu8()
I'm having a hard time narrowing down the source of the error,
though I do know that it occurs when the second call to
`parse-netstring' is evaluated, and I am assuming this is a bug because
my expectation would be that the REPL would behave exactly the same as
the Guile compiler.
Test case:
----------------------------- snip -----------------------------
(use-modules (rnrs bytevectors)
(rnrs bytevectors gnu))
(define (bytevector-index haystack needle)
(define len (bytevector-length haystack))
(let loop ((i 0))
(cond [(>= i len) #f]
[(= needle (bytevector-u8-ref haystack i)) i]
[else (loop (+ 1 i))])))
(define (parse-netstring bv)
(define split-index (bytevector-index bv (char->integer #\:)))
(unless split-index
(throw 'scgi-parse-error "netstring contains no delimiter character"))
(let* [(length-encoded (bytevector-slice bv 0 split-index))
(length-parsed (string->number (utf8->string length-encoded)))]
(unless length-parsed
(throw 'scgi-parse-error (format #f "illegal netstring length '~a'" length-encoded)))
(let* ([payload-start (+ 1 split-index)]
[payload-end (+ 1 payload-start length-parsed)]
[remaining (- (bytevector-length bv) payload-end)])
(values (bytevector-slice bv payload-start length-parsed)
(bytevector-slice bv payload-end remaining)))))
(parse-netstring (string->utf8 "13:Hello, world!,"))
(parse-netstring (string->utf8 "5:hello,"))
This bug report was last modified 23 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.