diff options
author | Ludovic Courtès <ludo@gnu.org> | 2015-03-05 22:00:11 +0100 |
---|---|---|
committer | Ludovic Courtès <ludo@gnu.org> | 2015-03-05 22:17:36 +0100 |
commit | ce72c780746776a86f59747f5eff8731cb4ff39b (patch) | |
tree | 72b3bd889fd71a4eeeca33811a56ec63cec52e1f /guix/store.scm | |
parent | 472e4c430343671a6cb4e5ed392beae04ef09da6 (diff) | |
download | gnu-guix-ce72c780746776a86f59747f5eff8731cb4ff39b.tar gnu-guix-ce72c780746776a86f59747f5eff8731cb4ff39b.tar.gz |
store: Attempt to decode build logs as UTF-8.
* guix/serialization.scm (read-maybe-utf8-string): New procedure.
* guix/store.scm (process-stderr): Use it for the build log and errors.
* tests/store.scm ("current-build-output-port, UTF-8",
"current-build-output-port, UTF-8 + garbage"): New tests.
Diffstat (limited to 'guix/store.scm')
-rw-r--r-- | guix/store.scm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/guix/store.scm b/guix/store.scm index d88fb3ea54..a3f3cbf43b 100644 --- a/guix/store.scm +++ b/guix/store.scm @@ -418,15 +418,18 @@ encoding conversion errors." (write-padding len p) #f)) ((= k %stderr-next) - ;; Log a string. - (let ((s (read-latin1-string p))) + ;; Log a string. Build logs are usually UTF-8-encoded, but they + ;; may also contain arbitrary byte sequences that should not cause + ;; this to fail. Thus, use the permissive + ;; 'read-maybe-utf8-string'. + (let ((s (read-maybe-utf8-string p))) (display s (current-build-output-port)) (when (string-any %newlines s) (flush-output-port (current-build-output-port))) #f)) ((= k %stderr-error) ;; Report an error. - (let ((error (read-latin1-string p)) + (let ((error (read-maybe-utf8-string p)) ;; Currently the daemon fails to send a status code for early ;; errors like DB schema version mismatches, so check for EOF. (status (if (and (>= (nix-server-minor-version server) 8) |