ericbavier wrote 6 years ago
(address . guix-patches@gnu.org)(name . Eric Bavier)(address . bavier@cray.com)
From: Eric Bavier <bavier@cray.com>
* guix/status.scm (build-event-output-port)[guile@2.0]: Do not call 'setvbuf'
on custom binary port.
* tests/status.scm (current-build-output-port, UTF-8 + garbage)[guile@2.0]:
Use "?" in place of REPLACEMENT CHARACTER.
---
guix/status.scm | 5 +++--
tests/status.scm | 5 ++++-
2 files changed, 7 insertions(+), 3 deletions(-)
Toggle diff (34 lines)
diff --git a/guix/status.scm b/guix/status.scm
index 13537c70c..6dba7e049 100644
--- a/guix/status.scm
+++ b/guix/status.scm
@@ -502,8 +502,9 @@ The second return value is a thunk to retrieve the current state."
;; The build port actually receives Unicode strings.
(set-port-encoding! port "UTF-8")
- (setvbuf port (cond-expand (guile-2.2 'line) (else _IOLBF)))
-
+ (cond-expand
+ ((and guile-2 (not guile-2.2)) #t)
+ (else (setvbuf port 'line)))
(values port (lambda () %state)))
(define (call-with-status-report on-event thunk)
diff --git a/tests/status.scm b/tests/status.scm
index 486ad04dd..846a6f415 100644
--- a/tests/status.scm
+++ b/tests/status.scm
@@ -124,7 +124,10 @@
(test-equal "current-build-output-port, UTF-8 + garbage"
;; What about a mixture of UTF-8 + garbage?
- '((build-log "garbage: �lambda: λ\n"))
+ (let ((replacement (cond-expand
+ ((and guile-2 (not guile-2.2)) "?")
+ (else "�"))))
+ `((build-log ,(string-append "garbage: " replacement "lambda: λ\n"))))
(let-values (((port get-status) (build-event-output-port cons '())))
(display "garbage: " port)
(put-bytevector port #vu8(128))
--
2.19.0