diff options
| author | Lars Magne Ingebrigtsen | 2014-12-13 15:50:28 +0100 |
|---|---|---|
| committer | Lars Magne Ingebrigtsen | 2014-12-13 15:50:28 +0100 |
| commit | 3e8e9713565c3cfacc33763e789514d5960c59e2 (patch) | |
| tree | 935e7b79374b2b2d388cd0941aa12cb095401d28 | |
| parent | c13baa10d55ec863d3ceaea48c6b2959ece98198 (diff) | |
| download | emacs-3e8e9713565c3cfacc33763e789514d5960c59e2.tar.gz emacs-3e8e9713565c3cfacc33763e789514d5960c59e2.zip | |
directory-files-recursively symlink fix
* files.el (directory-files-recursively): Really check whether
files are symlinks.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2014-12-13 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 2 | |||
| 3 | * files.el (directory-files-recursively): Really check whether | ||
| 4 | files are symlinks. | ||
| 5 | |||
| 1 | 2014-12-13 Artur Malabarba <bruce.connor.am@gmail.com> | 6 | 2014-12-13 Artur Malabarba <bruce.connor.am@gmail.com> |
| 2 | 7 | ||
| 3 | * emacs-lisp/package.el (package--list-loaded-files): New function | 8 | * 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." | |||
| 772 | 'string<)) | 772 | 'string<)) |
| 773 | (unless (member file '("./" "../")) | 773 | (unless (member file '("./" "../")) |
| 774 | (if (= (aref file (1- (length file))) ?/) | 774 | (if (= (aref file (1- (length file))) ?/) |
| 775 | (let ((path (expand-file-name file dir))) | 775 | (let* ((leaf (substring file 0 (1- (length file)))) |
| 776 | (path (expand-file-name leaf dir))) | ||
| 776 | ;; Don't follow symlinks to other directories. | 777 | ;; Don't follow symlinks to other directories. |
| 777 | (unless (file-symlink-p path) | 778 | (unless (file-symlink-p path) |
| 778 | (setq result (nconc result (directory-files-recursively | 779 | (setq result (nconc result (directory-files-recursively |
| 779 | path match include-directories)))) | 780 | path match include-directories)))) |
| 780 | (when (and include-directories | 781 | (when (and include-directories |
| 781 | (string-match match | 782 | (string-match match leaf)) |
| 782 | (substring file 0 (1- (length file))))) | ||
| 783 | (setq result (nconc result (list path))))) | 783 | (setq result (nconc result (list path))))) |
| 784 | (when (string-match match file) | 784 | (when (string-match match file) |
| 785 | (push (expand-file-name file dir) files))))) | 785 | (push (expand-file-name file dir) files))))) |