From: Lars Magne Ingebrigtsen Date: Sat, 13 Dec 2014 14:50:28 +0000 (+0100) Subject: directory-files-recursively symlink fix X-Git-Tag: emacs-25.0.90~2635^2~91 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=3e8e9713565c3cfacc33763e789514d5960c59e2;p=emacs.git directory-files-recursively symlink fix * files.el (directory-files-recursively): Really check whether files are symlinks. --- 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)))))