summary refs log tree commit diff
diff options
context:
space:
mode:
authorMathieu Othacehe <othacehe@gnu.org>2021-07-25 11:43:05 +0200
committerMathieu Othacehe <othacehe@gnu.org>2021-07-25 19:13:10 +0200
commit0236013cd0fc86ff4a042885c735e3f36a7f5c25 (patch)
tree4ad74624440c397a7c202a3e742b20dcb5108ff0
parenta682fea916b9f3ff101a76273aa754e11d53244d (diff)
downloadguix-0236013cd0fc86ff4a042885c735e3f36a7f5c25.tar.gz
build: utils: Trim leading slash from search-input-file input.
Make sure that both:

(search-input-file inputs "/bin/sh") and (search-input-file inputs "bin/sh")

are supported.

* guix/build/utils (search-input-file): Trim leading slash character from
FILE.
-rw-r--r--guix/build/utils.scm7
1 files changed, 5 insertions, 2 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index e7782d3e08..3beb7da67a 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -631,8 +631,11 @@ FILE must be a string like \"bin/sh\". If FILE is not found, an exception is
 raised."
   (match inputs
     (((_ . directories) ...)
-     (or (search-path directories file)
-         (raise (condition (&search-error (path directories) (file file))))))))
+     ;; Accept both "bin/sh" and "/bin/sh" as FILE argument.
+     (let ((file (string-trim file #\/)))
+       (or (search-path directories file)
+           (raise
+            (condition (&search-error (path directories) (file file)))))))))
 
 (define (search-input-directory inputs directory)
   "Find a sub-directory named DIRECTORY among the INPUTS and return its