Package: catfish
Version: 1.4.7-1
Default path exclusions ("~/.cache", "~/.gvfs" and "/dev") fail if they
match any fragment of the result path.
Test case:
mkdir ~/devel
touch ~/devel/123.txt
sudo mkdir /devel
sudo touch /devel/123.txt
sudo updatedb
locate 123.txt
# It founds both files.
catfish --start / 123.txt
# It doesn't found anything because result paths include "/dev" string.
Solution:
- Exclude paths must end with "/".
- Result paths must start with exclude path in order to be excluded.
Fix patch attached.
Best regards.
diff -Nru catfish-1.4.7.orig/catfish/CatfishSearchEngine.py catfish-1.4.7/catfish/CatfishSearchEngine.py
--- catfish-1.4.7.orig/catfish/CatfishSearchEngine.py 2019-01-20 16:26:25.000000000 +0100
+++ catfish-1.4.7/catfish/CatfishSearchEngine.py 2019-04-11 11:35:57.559838448 +0200
@@ -166,9 +166,9 @@
# Path exclusions for efficiency
exclude = []
maybe_exclude = [
- os.path.expanduser("~/.cache"),
- os.path.expanduser("~/.gvfs"),
- "/dev"
+ os.path.expanduser("~/.cache/"),
+ os.path.expanduser("~/.gvfs/"),
+ "/dev/"
]
for maybe_path in maybe_exclude:
if not path.startswith(maybe_path):
@@ -186,7 +186,7 @@
if isinstance(filename, str) and path in filename:
found_bad = False
for filepath in exclude:
- if filepath in filename:
+ if filename.startswith(filepath):
if self.stop_time > 0:
logger.debug("Engine is stopped")
return