! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Catfish traverses excluded ~/.cache, ~/.gvfs and /dev
Status:
RESOLVED: FIXED
Severity:
trivial
Product:
Catfish
Component:
General

Comments

Description Filip Brygidyn 2019-03-17 14:11:24 CET
Created attachment 8341 
proposed patch

There is a subtle bug in 'CatfishSearchMethod_Walk::run()' method - excluded dirs (~/.cache, ~/.gvfs and /dev) are not skipped - but the results are filtered again in 'CatfishSearchEngine::run()' so the result list is correct (although the search time is longer).

The problem is with the exclude logic:
Using os.walk() with bottom-up traverse order means that catfish will traverse insides of the directory before listing the dir itself,
Exclusion of dirs works by modifying the search results in-flight - line 'dirs[:] = [d for d in dirs if os.path.join(root, d) not in exclude]'.
As a result the code tries to exclude dirs it already went through.

This issue is also described on stack: https://stackoverflow.com/questions/31015780

I attached the patch to change the traversal order to top-down which fixes it but I am not sure why the traverse order was set to bottom-up in the first place. It is not the default option so I guess the author might have had something else in mind when writing this.
Comment 1 Git Bot editbugs 2019-07-22 19:58:18 CEST
Filip Brygidyn referenced this bugreport in commit 61f49ecab9fd830a1a17e17d6134015b970f0305

Traverse dirs top-down in 'walk' method (bug #15206)

https://git.xfce.org/apps/catfish/commit?id=61f49ecab9fd830a1a17e17d6134015b970f0305
Comment 2 Sean Davis editbugs 2019-07-22 19:59:18 CEST
Good catch! Applied with the above commit. As for the bottom-up traversal, I don't recall there being a specific reason for doing this, so we'll go top-down for now.

Bug #15206

Reported by:
Filip Brygidyn
Reported on: 2019-03-17
Last modified on: 2019-07-22

People

Assignee:
Sean Davis
CC List:
0 users

Version

Attachments

proposed patch (944 bytes, patch)
2019-03-17 14:11 CET , Filip Brygidyn
no flags

Additional information