From 3e8e9713565c3cfacc33763e789514d5960c59e2 Mon Sep 17 00:00:00 2001 From: Lars Magne Ingebrigtsen Date: Sat, 13 Dec 2014 15:50:28 +0100 Subject: [PATCH] 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 afe4b355c79..bc757189f60 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-12-13 Lars Magne Ingebrigtsen + + * files.el (directory-files-recursively): Really check whether + files are symlinks. + 2014-12-13 Artur Malabarba * emacs-lisp/package.el (package--list-loaded-files): New function diff --git a/lisp/files.el b/lisp/files.el index 40972d48b94..2ab740d4a7f 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))))) -- 2.11.4.GIT