From 347f54ed33a0b9a4e234d18dadf950f055e16554 Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Mon, 6 Apr 2015 23:09:54 +0200 Subject: utils: 'find-files' does not follow symlinks by default. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . Reported by Tomáš Čech . * guix/build/utils.scm (find-files): Add #:stat parameter. Pass it as last argument to 'file-system-fold'. --- guix/build/utils.scm | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'guix/build/utils.scm') diff --git a/guix/build/utils.scm b/guix/build/utils.scm index fbd5d54da5..676a0120e3 100644 --- a/guix/build/utils.scm +++ b/guix/build/utils.scm @@ -278,12 +278,14 @@ (define (file-name-predicate regexp) (lambda (file stat) (regexp-exec file-rx (basename file))))) -(define* (find-files dir #:optional (pred (const #t))) +(define* (find-files dir #:optional (pred (const #t)) + #:key (stat lstat)) "Return the lexicographically sorted list of files under DIR for which PRED returns true. PRED is passed two arguments: the absolute file name, and its stat buffer; the default predicate always returns true. PRED can also be a regular expression, in which case it is equivalent to (file-name-predicate -PRED)." +PRED). STAT is used to obtain file information; using 'lstat' means that +symlinks are not followed." (let ((pred (if (procedure? pred) pred (file-name-predicate pred)))) @@ -304,7 +306,8 @@ (define* (find-files dir #:optional (pred (const #t))) file (strerror errno)) result) '() - dir) + dir + stat) string