emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 3e8e971: directory-files-recursively symlink fix


From: Lars Ingebrigtsen
Subject: [Emacs-diffs] master 3e8e971: directory-files-recursively symlink fix
Date: Sat, 13 Dec 2014 14:51:02 +0000

branch: master
commit 3e8e9713565c3cfacc33763e789514d5960c59e2
Author: Lars Magne Ingebrigtsen <address@hidden>
Commit: Lars Magne Ingebrigtsen <address@hidden>

    directory-files-recursively symlink fix
    
    * files.el (directory-files-recursively): Really check whether
    files are symlinks.
---
 lisp/ChangeLog |    5 +++++
 lisp/files.el  |    6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index afe4b35..bc75718 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-13  Lars Magne Ingebrigtsen  <address@hidden>
+
+       * files.el (directory-files-recursively): Really check whether
+       files are symlinks.
+
 2014-12-13  Artur Malabarba  <address@hidden>
 
        * emacs-lisp/package.el (package--list-loaded-files): New function
diff --git a/lisp/files.el b/lisp/files.el
index 40972d4..2ab740d 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -772,14 +772,14 @@ If INCLUDE-DIRECTORIES, also include directories that 
have matching names."
                        'string<))
       (unless (member file '("./" "../"))
        (if (= (aref file (1- (length file))) ?/)
-           (let ((path (expand-file-name file dir)))
+           (let* ((leaf (substring file 0 (1- (length file))))
+                  (path (expand-file-name leaf dir)))
              ;; Don't follow symlinks to other directories.
              (unless (file-symlink-p path)
                (setq result (nconc result (directory-files-recursively
                                            path match include-directories))))
              (when (and include-directories
-                        (string-match match
-                                      (substring file 0 (1- (length file)))))
+                        (string-match match leaf))
                (setq result (nconc result (list path)))))
          (when (string-match match file)
            (push (expand-file-name file dir) files)))))



reply via email to

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