>From 50a671765b3d610e38f6e052a59b3eef316f4226 Mon Sep 17 00:00:00 2001 From: Maxim Cournoyer Date: Sun, 14 Jan 2018 22:38:20 -0500 Subject: [PATCH 3/4] emacs-build-system: Work around issue 30611. This is a temporary workaround issue 30611, where substitute* crashes on files containing NUL characters. * guix/build/emacs-build-system.scm (patch-el-files): Filter out elisp files that contain NUL characters. --- guix/build/emacs-build-system.scm | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/guix/build/emacs-build-system.scm b/guix/build/emacs-build-system.scm index 791af3437..83dd3e3c3 100644 --- a/guix/build/emacs-build-system.scm +++ b/guix/build/emacs-build-system.scm @@ -97,11 +97,26 @@ archive, a directory, or an Emacs Lisp file." (define* (patch-el-files #:key outputs #:allow-other-keys) "Substitute the absolute \"/bin/\" directory with the right location in the store in '.el' files." + + ;; TODO: Remove after issue 30611 is fixed in master (see: + ;; https://debbugs.gnu.org/30116). + (define (file-contains-nul-char? file) + (call-with-input-file file + (lambda (in) + (let loop ((line (read-line in 'concat))) + (cond + ((eof-object? line) #f) + ((string-index line #\nul) #t) + (else (loop (read-line in 'concat)))))) + #:binary #t)) + (let* ((out (assoc-ref outputs "out")) (elpa-name-ver (store-directory->elpa-name-version out)) (el-dir (string-append out %install-suffix "/" elpa-name-ver)) + (el-files (remove file-contains-nul-char? + (find-files "." "\\.el$"))) (substitute-cmd (lambda () - (substitute* (find-files "." "\\.el$") + (substitute* el-files (("\"/bin/([^.]\\S*)\"" _ cmd-name) (let ((cmd (which cmd-name))) (unless cmd -- 2.16.0