implement locate and updatedb#536
Conversation
|
cool, thanks :) |
|
add please add tests :) |
afeae83 to
eeb7ab5
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #536 +/- ##
==========================================
+ Coverage 91.78% 92.05% +0.27%
==========================================
Files 31 35 +4
Lines 6413 7090 +677
Branches 338 367 +29
==========================================
+ Hits 5886 6527 +641
- Misses 401 420 +19
- Partials 126 143 +17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
eeb7ab5 to
ae7b831
Compare
|
A couple notes:
|
| @@ -0,0 +1,79 @@ | |||
| // Copyright 2017 Google Inc. | |||
There was a problem hiding this comment.
| // Copyright 2017 Google Inc. |
be54aac to
26982d5
Compare
| @@ -0,0 +1,335 @@ | |||
| // Copyright 2017 Google Inc. | |||
There was a problem hiding this comment.
Same, please remove that line and the others
There was a problem hiding this comment.
You asked me in #536 (comment) to add the license header. Should I just be removing the Google line? If so, the most recent commit should be good. If I'm misunderstanding, let me know.
|
Is there a reason for the kill switch which blocks operation on Windows? Proper locate tool may be really interesting in the Windows world, where one would not have to install mingw or cygwin environments. |
|
@Code7R The current implementation of |
|
@sylvestre any updates here? |
1acd3f8 to
1e73b3f
Compare
|
sorry, let me have a look |
…yle cleanups - move invalid_db/old_db/test_data_db from repo root to test_data/db/ - remove add_special_files fixture that wrote into the tracked tree - replace clap-default unwrap()s and the match_entry CString unwrap - justify unreachable! branches; drop writeln!(...).unwrap() - remove #[allow(dead_code)] and unused localuser/netuser Config fields
… building - locate -e/-E: check the full path with correct follow semantics (a broken symlink is non-existent under -L/--follow, existent under -P/--nofollow); previously the follow flag was paired with the no-follow probe and basename mode checked the wrong path - locate --regex: report an uncompilable pattern as an error instead of silently dropping it (From -> TryFrom, new Error::InvalidRegex) - updatedb: build the find argv as discrete tokens rather than a formatted string that gets re-split on whitespace; an empty prunefs/prunepaths can no longer produce an invalid expression (empty '( )' group) - add unit tests for path_exists and integration tests for the above
closes #60
Given that locate has largely been replaced by (m|p)locate, I was unable to find a version of locate packaged for my system (latest Arch Linux), and the packaged version of updatedb does not use the LOCATE02 db format. When running updatedb from source, I encountered errors that were not immediately fixable. As such, this implementation is largely untested, but it's better to have something here to be improved upon.