[PATCH] ui: Fix abort on #\nul character in build output.

  • Done
  • quality assurance status badge
Details
2 participants
  • ericbavier
  • Ludovic Courtès
Owner
unassigned
Submitted by
ericbavier
Severity
normal

Debbugs page

ericbavier wrote 6 years ago
(address . guix-patches@gnu.org)(name . Eric Bavier)(address . bavier@member.fsf.org)
20180912023823.13240-1-ericbavier@centurylink.net
From: Eric Bavier <bavier@member.fsf.org>

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(-)

Toggle diff (38 lines)
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
Ludovic Courtès wrote 6 years ago
(address . ericbavier@centurylink.net)
8736tt1fzq.fsf@gnu.org
Hi Eric,

ericbavier@centurylink.net skribis:

Toggle quote (7 lines)
> From: Eric Bavier <bavier@member.fsf.org>
>
> 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’.
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 32711@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 32711
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch
You may also tag this issue. See list of standard tags. For example, to set the confirmed and easy tags
mumi command -t +confirmed -t +easy
Or, remove the moreinfo tag and set the help tag
mumi command -t -moreinfo -t +help