[Xfce4-commits] [apps/catfish] 01/02: Walk Method: Improve link traversal skipping

noreply at xfce.org noreply at xfce.org
Thu Dec 19 12:33:21 CET 2019


This is an automated email from the git hooks/post-receive script.

b   l   u   e   s   a   b   r   e       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository apps/catfish.

commit cac84de5bd284b9d04406938d7053dd00141c045
Author: Filip Brygidyn <git at koumakan.org>
Date:   Sat Dec 14 17:20:37 2019 +0100

    Walk Method: Improve link traversal skipping
    
    Signed-off-by: Sean Davis <smd.seandavis at gmail.com>
---
 catfish/CatfishSearchEngine.py | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/catfish/CatfishSearchEngine.py b/catfish/CatfishSearchEngine.py
index 6942de2..178c1f5 100644
--- a/catfish/CatfishSearchEngine.py
+++ b/catfish/CatfishSearchEngine.py
@@ -296,7 +296,7 @@ class CatfishSearchMethod_Walk(CatfishSearchMethod):
         """Initialize the 'walk' Search Method."""
         CatfishSearchMethod.__init__(self, "walk")
 
-    def get_dir_list(self, root, dirs, xdg_list, exclude_list):
+    def get_dir_list(self, root, dirs, xdg_list, exclude_list, processed_links):
         dirs = sorted(dirs, key=lambda s: s.lower())
 
         # Prioritize: XDG, Visible (Linked), Dotfile (Linked)
@@ -316,6 +316,11 @@ class CatfishSearchMethod_Walk(CatfishSearchMethod):
                 xdgdirs.append(path)
                 continue
             islink = os.path.islink(path)
+            if islink:
+                realpath = os.path.realpath(path)
+                if realpath in processed_links:
+                    continue
+                processed_links.append(realpath)
             if os.path.basename(path).startswith("."):
                 if islink:
                     dotlinks.append(path)
@@ -378,7 +383,7 @@ class CatfishSearchMethod_Walk(CatfishSearchMethod):
                 processed_links.append(realpath)
 
             # Prioritize and drop excluded paths
-            dirs[:] = self.get_dir_list(root, dirs, xdgdirlist, exclude)
+            dirs[:] = self.get_dir_list(root, dirs, xdgdirlist, exclude, processed_links)
 
             paths = dirs + files
             paths.sort()

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list