-
-
Notifications
You must be signed in to change notification settings - Fork 718
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement DirTraversal #531
Conversation
7b420ec
to
ccea006
Compare
5c57d55
to
4573b5b
Compare
@qarmin what do you think about the code, is this the right direction? |
Removing duplicated code is always good, but I have some concerns about it
|
So I suppose after you will check performance, we can merge this PR. I can add memory statistics in another PR according to this post https://stackoverflow.com/questions/30869007/how-to-benchmark-memory-usage-of-a-function |
@qarmin I believe small cache size can be retained with an implementation that is generic over the type of additional file entry information. I can do this in a future PR. How about we divide the work over multiple PRs for easier code review? |
Looks that PR is OK and I could merge it because I didn't find any performance degradation and also cache for now is same as before(only duplicates from changed modes in this PR uses cache system, but it is my custom implementation(similar image use bincode)). The only problem is with invalid symlinks, because a little after start I have this crash
|
@qarmin I could not reproduce the problem on my system. Could you send me test data? I would like to make a regression test case. Even though I could not reproduce the problem, or figure it out by reading the code, I found bugs in my code. Please try symlinks again with the latest commit -- they should work. |
} else if metadata.is_file() { | ||
entry_type = EntryType::File; | ||
} else { | ||
unreachable!(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reachable and should be ignored
thread '<unnamed>' panicked at 'internal error: entered unreachable code', czkawka_core/src/common_dir_traversal.rs:398:29
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
drwx------ 2 rafal rafal 4096 sty 1 10:42 .
drwx------ 56 rafal rafal 4096 sty 1 07:43 ..
-rw------- 1 rafal rafal 1812 gru 11 09:25 Configuration.xml
prw------- 1 rafal rafal 0 sty 1 07:12 .show-request-queue <---------- This cause crash
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@qarmin fixed in the most recent commit
I tried several times to find symlink which cause crash with older version of this PR, but I couldn't find it and looks that only crash happens with specific combination of folders and files. |
Thanks! |
Uses a builder pattern to provide a common mechanism for file and directory search.
TODO: migrate other search categories.