]> git.eshelyaron.com Git - emacs.git/commitdiff
directory-files-recursively symlink fix
authorLars Magne Ingebrigtsen <larsi@gnus.org>
Sat, 13 Dec 2014 14:50:28 +0000 (15:50 +0100)
committerLars Magne Ingebrigtsen <larsi@gnus.org>
Sat, 13 Dec 2014 14:50:28 +0000 (15:50 +0100)
* files.el (directory-files-recursively): Really check whether
files are symlinks.

lisp/ChangeLog
lisp/files.el

index afe4b355c795658c37fc6c496faf733a9fa33a81..bc757189f60bc28c42b2c7030912cd2763b7c7e0 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-13  Lars Magne Ingebrigtsen  <larsi@gnus.org>
+
+       * files.el (directory-files-recursively): Really check whether
+       files are symlinks.
+
 2014-12-13  Artur Malabarba  <bruce.connor.am@gmail.com>
 
        * emacs-lisp/package.el (package--list-loaded-files): New function
index 40972d48b942df8493cd8e5812861c3043d92ed3..2ab740d4a7f12c88a4fe2483015890500ea5b961 100644 (file)
@@ -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)))))