bc: fix log-message handling of prefix-message? argument

Closes #3168
This commit is contained in:
Matthew Flatt 2020-05-09 09:39:00 -06:00
parent fae20b4b89
commit 7a95ff3dd4
2 changed files with 20 additions and 1 deletions

View File

@ -348,6 +348,25 @@
;; Retain receiver
(test #f sync/timeout 0 r2))
; --------------------
;; Regression test for `log-message` mis-parsing arguments,
;; based on Cameron Moy's example
(let ()
(define-logger hello)
(define (f)
(log-hello-info "foo")
(define result (findf (λ (x) #f) null)) ; provokes a false in the right place...
(log-hello-info "bar")
result)
(set! f f)
(define recv (make-log-receiver hello-logger 'info))
(f)
(test "hello: foo" vector-ref (sync recv) 1)
(test "hello: bar" vector-ref (sync recv) 1))
; --------------------
(report-errs)

View File

@ -4085,7 +4085,7 @@ log_message(int argc, Scheme_Object *argv[])
bytes = scheme_char_string_to_byte_string(bytes);
pos++;
if (argc >= (pos+1))
if (argc > (pos+1))
pfx = SCHEME_TRUEP(argv[pos+1]);
else
pfx = 1;