Skip to content

fix: make --version output consistent across utilities - #838

Merged
sylvestre merged 3 commits into
uutils:mainfrom
Xylphy:fix/inconsistent-version-output
Aug 16, 2026
Merged

sylvestre merged 3 commits into
uutils:mainfrom
Xylphy:fix/inconsistent-version-output

Conversation

@Xylphy

@Xylphy Xylphy commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #837.

Problem

The --version output is inconsistent across utilities.

Updated behavior:

$ ./find --version
find 0.10.0

$ ./locate --version
locate 0.10.0

$ ./updatedb --version
updatedb 0.10.0

$ ./xargs --version
xargs 0.10.0

Copilot AI lite review requested due to automatic review settings August 16, 2026 05:33
@codecov

codecov Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.96%. Comparing base (aeb8f59) to head (37be5c0).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #838      +/-   ##
==========================================
+ Coverage   91.93%   91.96%   +0.03%     
==========================================
  Files          35       35              
  Lines        7253     7258       +5     
  Branches      378      378              
==========================================
+ Hits         6668     6675       +7     
+ Misses        443      441       -2     
  Partials      142      142              

☔ View full report in Codecov by Harness.
📢 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR aims to standardize --version output across the findutils Rust utilities so each tool prints just <util> <version> without extra prefixes or error wrappers.

Changes:

  • Adjust find --version output to remove the (Rust) suffix.
  • Change updatedb argument parsing so --version no longer shows up as an error-prefixed message.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
src/updatedb/mod.rs Changes clap parsing behavior to avoid error-wrapped --version output (but currently exits the process on parse errors).
src/find/mod.rs Updates --version formatting to find <version> for consistency.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/updatedb/mod.rs Resolved
@github-actions

Copy link
Copy Markdown

Commit 077eb5a has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 313 / PASSED: 267 / FAILED: 40 / SKIPPED: 6
  Reference: TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6

Changes from main branch:
  TOTAL: -1
  PASSED: +0
  FAILED: -1

Test improvements (1):
  + gnu/okdir_path_relative

@codspeed

codspeed Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing Xylphy:fix/inconsistent-version-output (37be5c0) with main (aeb8f59)

Open in CodSpeed

Copilot AI review requested due to automatic review settings August 16, 2026 05:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (2)

src/find/mod.rs:413

  • The updated version string format for find --version isn’t covered by tests, so regressions (e.g., reintroducing the "(Rust)" suffix) would be easy to miss. Consider adding an integration test that runs find --version and asserts stdout matches ^find \d+\.\d+\.\d+\s*$ and stderr is empty.
fn print_version(deps: &dyn Dependencies) -> Result<(), io::Error> {
    writeln!(
        &mut deps.get_output().borrow_mut(),
        "find {}",
        env!("CARGO_PKG_VERSION")
    )

src/updatedb/mod.rs:276

  • The new --version/--help handling relies on special-casing Clap’s DisplayHelp/DisplayVersion errors to avoid returning an error (and therefore printing Error: in updatedb_main). There’s currently no test ensuring updatedb --version exits successfully and prints only updatedb <version> on stdout with no Error: prefix on stderr; adding one would prevent regressions.
    let matches = match uu_app().try_get_matches_from(args) {
        Ok(m) => m,
        Err(e) => match e.kind() {
            clap::error::ErrorKind::DisplayHelp | clap::error::ErrorKind::DisplayVersion => {
                print!("{e}");
                return Ok(());
            }
            _ => return Err(uucore::error::UClapError::with_exit_code(e, 1).into()),
        },

@github-actions

Copy link
Copy Markdown

Commit ff3d8c3 has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 316 / PASSED: 267 / FAILED: 43 / SKIPPED: 6
  Reference: TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6

Changes from main branch:
  TOTAL: +2
  PASSED: +0
  FAILED: +2

New test failures (2):
  - gnu/files0_from_ok
  - gnu/okdir_path_dot

@sylvestre

Copy link
Copy Markdown
Contributor

Please add a test to make sure we don't regress in the future

Copilot AI review requested due to automatic review settings August 16, 2026 11:30

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

Copy link
Copy Markdown

Commit 37be5c0 has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6
  Reference: TOTAL: 314 / PASSED: 267 / FAILED: 41 / SKIPPED: 6

New test failures (1):
  - gnu/files0_from_ok

Test improvements (1):
  + gnu/okdir_path_relative

@Xylphy

Xylphy commented Aug 16, 2026

Copy link
Copy Markdown
Contributor Author

@sylvestre Done!

@sylvestre
sylvestre merged commit 7ac06f1 into uutils:main Aug 16, 2026
21 of 22 checks passed
@Xylphy
Xylphy deleted the fix/inconsistent-version-output branch August 16, 2026 23:24
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.

Inconsistent --version output

3 participants