From cb85eb5e6569378d444b45cf209324e38f6ec0f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 23 Apr 2015 11:59:35 +0200 Subject: [PATCH] build-system/gnu: Gracefully handle dangling symlinks. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . Reported by Tomáš Čech . * guix/build/gnu-build-system.scm (patch-source-shebangs): Remove files that don't pass 'file-exists?'. (patch-generated-file-shebangs): Likewise. --- guix/build/gnu-build-system.scm | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/guix/build/gnu-build-system.scm b/guix/build/gnu-build-system.scm index c60f8ba162..00422458ab 100644 --- a/guix/build/gnu-build-system.scm +++ b/guix/build/gnu-build-system.scm @@ -164,7 +164,10 @@ (define* (patch-source-shebangs #:key source #:allow-other-keys) $CONFIG_SHELL, but some don't, such as `mkinstalldirs' or Automake's `missing' script." (for-each patch-shebang - (remove file-is-directory? (find-files "." ".*")))) + (remove (lambda (file) + (or (not (file-exists? file)) ;dangling symlink + (file-is-directory? file))) + (find-files ".")))) (define (patch-generated-file-shebangs . rest) "Patch shebangs in generated files, including `SHELL' variables in @@ -173,9 +176,10 @@ (define (patch-generated-file-shebangs . rest) ;; `configure'. (for-each patch-shebang (filter (lambda (file) - (and (executable-file? file) + (and (file-exists? file) + (executable-file? file) (not (file-is-directory? file)))) - (find-files "." ".*"))) + (find-files "."))) ;; Patch `SHELL' in generated makefiles. (for-each patch-makefile-SHELL (find-files "." "^(GNU)?[mM]akefile$")))