guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/01: utils: 'find-files' does not follow symlinks by default.


From: Ludovic Courtès
Subject: 01/01: utils: 'find-files' does not follow symlinks by default.
Date: Mon, 06 Apr 2015 21:20:46 +0000

civodul pushed a commit to branch core-updates
in repository guix.

commit 347f54ed33a0b9a4e234d18dadf950f055e16554
Author: Ludovic Courtès <address@hidden>
Date:   Mon Apr 6 23:09:54 2015 +0200

    utils: 'find-files' does not follow symlinks by default.
    
    Fixes <http://bugs.gnu.org/20081>.
    Reported by Tomáš Čech <address@hidden>.
    
    * guix/build/utils.scm (find-files): Add #:stat parameter.  Pass it as
      last argument to 'file-system-fold'.
---
 guix/build/utils.scm |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index fbd5d54..676a012 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -278,12 +278,14 @@ name matches 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 @@ PRED)."
                                       file (strerror errno))
                               result)
                             '()
-                            dir)
+                            dir
+                            stat)
           string<?)))
 
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]