1064 Commits

Author SHA1 Message Date
Sylvestre Ledru baa6ce5d92 find: fix clippy::unnecessary_semicolon 2026-06-08 22:48:45 +02:00
Sylvestre Ledru 9f33c14fc9 find: fix clippy::map_unwrap_or 2026-06-08 22:48:45 +02:00
Sylvestre Ledru a80620c88f find: fix clippy::redundant_closure_for_method_calls 2026-06-08 22:48:45 +02:00
Sylvestre Ledru a2c75f94ca prepare release 0.9.0 (#714) 2026-06-08 22:44:43 +02:00
dependabot[bot] 44fbc59263 build(deps): bump rstest from 0.25.0 to 0.26.1 (#710)
Bumps [rstest](https://github.com/la10736/rstest) from 0.25.0 to 0.26.1.
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](https://github.com/la10736/rstest/compare/v0.25.0...v0.26.1)

---
updated-dependencies:
- dependency-name: rstest
  dependency-version: 0.26.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-08 08:40:05 +02:00
✿ Fleur de Blue fb9f8df047 fix: Handle write failures when printing --help/--version (#656) 2026-06-07 19:05:03 +02:00
Sylvestre Ledru 2044d1e31d make locate and updatedb work on Windows (#704)
locate and updatedb were Unix-only (gated behind cfg and stubbed out on
Windows). Make them cross-platform:

- locate: decode raw DB entries via a platform-specific bytes_to_path
  (verbatim bytes on Unix, lossy UTF-8 elsewhere), use Metadata::len()
  instead of the unix-only size(), and a cross-platform make_symlink in
  tests that skips gracefully when symlink creation is unprivileged.
- drop the #[cfg(unix)] gate on the locate module and the
  "unsupported on Windows" main stubs for locate/updatedb.
- db_tests: remove #[cfg(not(windows))] gates, write updatedb output to
  a tempdir instead of /dev/null, and add a full updatedb->locate
  roundtrip test that is platform-independent.
2026-06-07 11:52:08 +02:00
Jesse Rosenstock 0494ba1be4 find: Update --help text (#707)
Replace the "early alpha implementation" placeholder help text with a
proper organized reference grouped by category (global options,
operators, positional options, tests, and actions), with brief
descriptions for each entry. The old text was a flat list that hadn't
kept up with the implementation and still carried the "early alpha"
disclaimer.

Also fix a typo in a comment: "- newercm" -> "-newercm".
2026-06-07 11:51:45 +02:00
Sylvestre Ledru fc446aba0b ci: add CodSpeed benchmarks for updatedb and locate (#705)
Drive both utilities end-to-end through their real entry points.

- benches/updatedb_bench.rs: walks a generated tree (~8.5k paths) and
  writes a LOCATE02 database, measuring the walk + front-coding + write
  (full build and a -regex/-prune variant). Empty prune options keep the
  run deterministic regardless of temp_dir location.
- benches/locate_bench.rs: builds the database once via updatedb, then
  scans it in -c/count mode so database decoding and pattern matching
  dominate (no-match, substring, -b basename, -i ignore-case, -r regex).
  Unix-only, matching the locate module's cfg.

The existing CodSpeed workflow picks these up via cargo codspeed build/run.
2026-06-06 11:00:04 +02:00
Sylvestre Ledru 33703b79d8 ci: add CodSpeed benchmarks for find and xargs (#703)
Introduce criterion benchmarks (via codspeed-criterion-compat) that drive
find and xargs end-to-end through their real entry points, plus a CodSpeed
GitHub Actions workflow to track performance on pushes and PRs.

- benches/find_bench.rs: walks a generated directory tree exercising the
  matcher tree (-name/-iname/-regex/-size/-type, grouping, -prune, -printf).
  Output is sent to a sink so the directory walk and matching dominate.
- benches/xargs_bench.rs: feeds a corpus via -a and runs 'true' so xargs'
  own argument reading/splitting/batching dominates (whitespace, NUL, -n, -s).
- .github/workflows/codspeed.yml: mirrors the uutils/grep setup.
2026-06-06 10:37:56 +02:00
Jeremy Smart c5ff1bbb6b implement locate and updatedb (#536)
---------

Co-authored-by: Sylvestre Ledru <sylvestre@debian.org>
2026-06-06 10:10:44 +02:00
Sylvestre Ledru e7c34ab12f test: properly exercise {} in -exec utility name (#702)
The test from #647 used {} only in an argument, so it passed on
unpatched code. Rewrite it to make the matched entry the
testing-commandline binary and pass {} as the utility name, so the
placeholder must resolve to the entry's path and execute.
2026-06-06 09:35:34 +02:00
Matt Van Horn 1a77a83432 fix: replace {} placeholder in -exec utility name (#647)
* fix: replace {} placeholder in -exec utility name

The {} placeholder was only replaced in arguments to -exec, not in the
utility_name position itself. Running `find -exec {} \;` passed the
literal string "{}" to Command::new, causing "No such file or directory".

Extracted arg parsing into a shared `parse_arg` helper and changed the
`executable` field from String to the existing Arg enum so it undergoes
the same {} replacement as other arguments.

Fixes #614

* test: add test for {} placeholder in utility name

Verify that SingleExecMatcher resolves {} in arguments
when the executable is a known path. Covers the case
where -exec receives {} in argument positions.

---------

Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
2026-06-06 08:50:24 +02:00
Sylvestre Ledru a65160f724 find: match GNU prompt format for -ok/-okdir (#699)
The -ok/-okdir prompt rendered the full substituted command, but GNU
find prints a fixed, abbreviated form: "< executable ... pathname > ? "
(literal ..., a space before ?, and always the full entry path even for
-okdir). Match it exactly and update the prompt-format test.

Verified byte-for-byte against GNU findutils 4.10.0.
2026-06-05 13:18:13 +08:00
dependabot[bot] 435f00d491 build(deps): bump softprops/action-gh-release from 2 to 3
Bumps [softprops/action-gh-release](https://github.com/softprops/action-gh-release) from 2 to 3.
- [Release notes](https://github.com/softprops/action-gh-release/releases)
- [Changelog](https://github.com/softprops/action-gh-release/blob/master/CHANGELOG.md)
- [Commits](https://github.com/softprops/action-gh-release/compare/v2...v3)

---
updated-dependencies:
- dependency-name: softprops/action-gh-release
  dependency-version: '3'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-05 07:10:08 +02:00
dependabot[bot] db941e7fba build(deps): bump chrono from 0.4.44 to 0.4.45
Bumps [chrono](https://github.com/chronotope/chrono) from 0.4.44 to 0.4.45.
- [Release notes](https://github.com/chronotope/chrono/releases)
- [Changelog](https://github.com/chronotope/chrono/blob/main/CHANGELOG.md)
- [Commits](https://github.com/chronotope/chrono/compare/v0.4.44...v0.4.45)

---
updated-dependencies:
- dependency-name: chrono
  dependency-version: 0.4.45
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-05 07:08:07 +02:00
Sylvestre Ledru 5bef01f72f github action: publish the release as draft first (#530) 2026-06-04 22:51:02 +02:00
oech3 575bf0aef9 Publish binary from main instead of discarding (#618) latest-commit 2026-06-04 22:34:18 +02:00
vip892766gma b07b27d13f chore: improve findutils maintenance path (#687) 2026-06-04 21:28:34 +02:00
Sylvestre Ledru 9a1e379a9d fix: avoid panic on -fprintf with missing arguments (#698)
Fixes #696
2026-06-05 02:41:58 +08:00
Jesse Rosenstock 5269e233a6 find: implement -ok and -okdir (#650)
-ok is like -exec ... ; but prompts the user on stderr before each
invocation and only runs the command if the response is affirmative
(starts with 'y' or 'Y').  -okdir is the corresponding -execdir variant.
Only the ';' terminator is accepted: POSIX does not define -ok ... + and
GNU find rejects it.

Response source: GNU find reads from /dev/tty so that the user's answer
always comes from the real terminal even when stdin is occupied (e.g.
`find -files0-from - -ok rm {} \;` reads paths from stdin, so responses
cannot also come from there).  /dev/tty is the POSIX name for a
process's controlling terminal and exists on all Unix-like systems.  We
open /dev/tty only when stdin is itself a terminal
(std::io::stdin().is_terminal() == true).  When stdin is a pipe or file,
we read from stdin directly — matching BSD find and making scripted use
(and integration tests via pipe_in()) work naturally without any special
environment variable.  On Windows, or when /dev/tty cannot be opened, we
likewise fall back to stdin.

Implementation: rather than a separate OkMatcher that duplicated
SingleExecMatcher's fields, constructor, and exec logic, the interactive
prompt is folded into SingleExecMatcher behind an `interactive: bool`
field.  `SingleExecMatcher::new_interactive()` constructs the -ok/-okdir
variant; `matches()` adds a guarded block that builds a GNU-find-style
prompt ("< executable arg... >? ") and calls `matcher_io.confirm()`
before executing.  If the user declines, the expression is false and the
command is not run.  This keeps the arg-parsing, path resolution,
current_dir logic, and error handling in one place so bug fixes apply to
both -exec and -ok.

Dependencies::confirm() trait method: abstracts prompt+read so matchers
remain testable without a real terminal; FakeDependencies uses a
VecDeque of preset responses.

Tests:
- Unit tests (exec_unit_tests.rs): confirmed executes command, declined
  skips command and returns false, confirmed but command fails returns
  false, -okdir runs in parent dir
- Parser unit tests (matchers/mod.rs): missing-arg errors, missing
  semicolon, correct parse, confirm/decline via FakeDependencies
- Integration tests (test_find.rs): pipe_in() makes stdin a pipe so
  is_terminal() returns false and responses are read from the pipe;
  "y"/"Y"/"yes"/" y" run command, "n" and empty response skip command,
  -okdir runs in parent dir, prompt format verified, missing-semicolon
  error

Closes https://github.com/uutils/findutils/issues/8.
2026-06-04 20:31:54 +02:00
dependabot[bot] fd876a7a8a build(deps): bump ctor from 1.0.6 to 1.0.7
Bumps [ctor](https://github.com/mmastrac/linktime) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/mmastrac/linktime/releases)
- [Changelog](https://github.com/mmastrac/linktime/blob/master/CHANGELOG.md)
- [Commits](https://github.com/mmastrac/linktime/compare/ctor-1.0.6...ctor-1.0.7)

---
updated-dependencies:
- dependency-name: ctor
  dependency-version: 1.0.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 08:32:49 +02:00
dependabot[bot] cffa946ffa build(deps): bump uucore from 0.8.0 to 0.9.0
Bumps [uucore](https://github.com/uutils/coreutils) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/uutils/coreutils/releases)
- [Commits](https://github.com/uutils/coreutils/compare/0.8.0...0.9.0)

---
updated-dependencies:
- dependency-name: uucore
  dependency-version: 0.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 08:32:25 +02:00
dependabot[bot] 032d1c1fc0 build(deps): bump uutests from 0.8.0 to 0.9.0
Bumps [uutests](https://github.com/uutils/coreutils) from 0.8.0 to 0.9.0.
- [Release notes](https://github.com/uutils/coreutils/releases)
- [Commits](https://github.com/uutils/coreutils/compare/0.8.0...0.9.0)

---
updated-dependencies:
- dependency-name: uutests
  dependency-version: 0.9.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-06-01 08:26:02 +02:00
Sylvestre Ledru fe9e872710 CONTRIBUTING: link to the review guidelines website 2026-05-30 10:00:13 +02:00