Skip to content

implement locate and updatedb #536

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Qelxiros
Copy link

@Qelxiros Qelxiros commented Apr 14, 2025

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.

@sylvestre
Copy link
Contributor

cool, thanks :)
a bunch of tasks are failing

@sylvestre
Copy link
Contributor

add please add tests :)

Copy link

codecov bot commented Apr 16, 2025

Codecov Report

Attention: Patch coverage is 86.50794% with 85 lines in your changes missing coverage. Please review.

Project coverage is 87.30%. Comparing base (a607612) to head (cb3e399).

Files with missing lines Patch % Lines
src/locate/mod.rs 83.13% 49 Missing and 21 partials ⚠️
src/updatedb/mod.rs 92.75% 11 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #536      +/-   ##
==========================================
- Coverage   87.69%   87.30%   -0.40%     
==========================================
  Files          31       35       +4     
  Lines        6893     6930      +37     
  Branches      324      353      +29     
==========================================
+ Hits         6045     6050       +5     
- Misses        617      628      +11     
- Partials      231      252      +21     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Qelxiros
Copy link
Author

Qelxiros commented Apr 16, 2025

A couple notes:

  • User flags are ignored for updatedb. GNU/BSD/Apple implementations all use a shell script, so they have direct access to su. I'm not sure if there's a better solution from rust, but I left it alone for now.
  • Performance is pretty significantly worse than GNU for updatedb. It might be a problem with find, since updatedb delegates most of the work to it. Locate is about on par with GNU for the one test that I did. I'd love another set of eyes to look for improvements.
  • I'll fix coverage issues tomorrow.
  • Looks like Release / plan is failing due to the Ubuntu 20.04 test runner no longer being available. Is that as simple a fix as updating it to 22.04 or later?

@Qelxiros Qelxiros changed the title implement locate (updatedb coming soon) implement locate and updatedb Apr 16, 2025
src/db_tests.rs Outdated
@@ -0,0 +1,79 @@
// Copyright 2017 Google Inc.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Copyright 2017 Google Inc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

locate and updatedb
2 participants