--- Begin Message ---
Subject: |
[PATCH] ui: Fix abort on #\nul character in build output. |
Date: |
Tue, 11 Sep 2018 21:38:23 -0500 |
From: Eric Bavier <address@hidden>
Fixes build of "lz4" package, e.g.
* guix/ui.scm (build-output-port)[handle-string]: Check for #\nul before doing
any regex matching.
---
guix/ui.scm | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
diff --git a/guix/ui.scm b/guix/ui.scm
index c55ae7e2f..207aba8ad 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1762,18 +1762,19 @@ phase announcements and replaces any other output with
a spinner."
RED BLUE RED BLUE RED BLUE))))
(lambda (str)
(let ((processed
- (any (match-lambda
- ((pattern #:transform transform)
- (and=> (string-match pattern str)
- transform))
- ((pattern . colors)
- (and=> (string-match pattern str)
- (lambda (m)
- (let ((substrings
- (map (cut match:substring m <>)
- (iota (- (match:count m) 1) 1))))
- (string-join (map proc substrings colors)
""))))))
- rules)))
+ (and (not (string-index str #\nul)) ;(ice-9 regex) cannot
handle #\nul
+ (any (match-lambda
+ ((pattern #:transform transform)
+ (and=> (string-match pattern str)
+ transform))
+ ((pattern . colors)
+ (and=> (string-match pattern str)
+ (lambda (m)
+ (let ((substrings
+ (map (cut match:substring m <>)
+ (iota (- (match:count m) 1)
1))))
+ (string-join (map proc substrings
colors) ""))))))
+ rules))))
(when spun?
(display (string #\backspace) port))
(if processed
--
2.18.0
--- End Message ---
--- Begin Message ---
Subject: |
Re: [bug#32711] [PATCH] ui: Fix abort on #\nul character in build output. |
Date: |
Fri, 28 Sep 2018 23:14:49 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi Eric,
address@hidden skribis:
> From: Eric Bavier <address@hidden>
>
> Fixes build of "lz4" package, e.g.
>
> * guix/ui.scm (build-output-port)[handle-string]: Check for #\nul before doing
> any regex matching.
This is fixed in the new (guix status) code, commit
dc0f74e5fc26977a3ee6c4f2aa74a141f4359982 (see the ‘color-rules’ macro.)
Thank you, and sorry for not responding earlier!
Ludo’.
--- End Message ---