emacs-elpa-diffs
[Top][All Lists]
Advanced

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

[nongnu] elpa/go-mode 287595a 420/495: Don't traverse symlinks when recu


From: ELPA Syncer
Subject: [nongnu] elpa/go-mode 287595a 420/495: Don't traverse symlinks when recursing directories
Date: Sat, 7 Aug 2021 09:06:00 -0400 (EDT)

branch: elpa/go-mode
commit 287595a375388cce16ecd8f44b44008e7679bc59
Author: Dominik Honnef <dominik@honnef.co>
Commit: Dominik Honnef <dominik@honnef.co>

    Don't traverse symlinks when recursing directories
    
    A symlink pointing to its containing directory would lead to an
    infinite loop. A symlink pointing outside the parent directory could
    potentially yield "subdirectories" that aren't sub.
    
    There are some correctness concerns with simply ignoring symlinks, but
    they're all offset by other circumstances: for one, the go tool itself isn't
    very fond of symlinks. Second, the only consumer of go--directory-dirs is
    go-packages-native, which in the presence of modules and the way
    modern Go caches build artifacts doesn't work reliably, anyway.
    
    As such, just making sure that we avoid infinite recursion, at the
    cost of maybe missing some packages in bizarre setups, beats coming up
    with a much more convoluted solution. We never intended to walk
    symlinks in the first place.
---
 go-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/go-mode.el b/go-mode.el
index ed7ca11..073cd22 100644
--- a/go-mode.el
+++ b/go-mode.el
@@ -1382,7 +1382,8 @@ If IGNORE-CASE is non-nil, the comparison is 
case-insensitive."
         (dolist (file files)
           (unless (member file '("." ".."))
             (let ((file (concat dir "/" file)))
-              (if (file-directory-p file)
+              (if (and (file-directory-p file)
+                       (not (file-symlink-p file)))
                   (setq dirs (append (cons file
                                            (go--directory-dirs file))
                                      dirs))))))



reply via email to

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