Skip to content

find: name the output file that -fprint, -fprint0, -fprintf and -fls cannot open - #1075

Open
andretorresdg wants to merge 1 commit into
uutils:mainfrom
andretorresdg:fprint-error-names-file
Open

andretorresdg wants to merge 1 commit into
uutils:mainfrom
andretorresdg:fprint-error-names-file

Conversation

@andretorresdg

Copy link
Copy Markdown
Contributor

When the output file of -fprint, -fprint0, -fprintf or -fls cannot be created, the error only had the OS message, with no hint of which file was meant:

$ find . -fprint /nonexistent/out
find: No such file or directory (os error 2)          # before
find: /nonexistent/out: No such file or directory (os error 2)   # after
find: '/nonexistent/out': No such file or directory   # GNU 4.11

The path is now prefixed with the name_file helper that -newer, -newerXY and -samefile already use (#923), so the message has the same shape as those.

Closes #1070

How I tested

  • New find_output_file_error_names_it test in tests/test_find.rs covering the four actions (fails before, passes after).
  • cargo test, cargo fmt --all -- --check, cargo clippy --all-targets -- -D warnings.

…cannot open

When the output file could not be created, the error was only the OS
message, e.g. "find: No such file or directory (os error 2)", with no
hint of which file was meant. GNU find names it. Prefix the path with
the name_file helper that -newer and -samefile already use.
@codecov

codecov Bot commented Nov 29, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.44%. Comparing base (0c8ef51) to head (2acdbeb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1075   +/-   ##
=======================================
  Coverage   92.44%   92.44%           
=======================================
  Files          38       38           
  Lines        8894     8895    +1     
  Branches      440      440           
=======================================
+ Hits         8222     8223    +1     
  Misses        532      532           
  Partials      140      140           

☔ 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.

@codspeed

codspeed Bot commented Nov 29, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

1 warning

⚠️ 15 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

✅ 20 untouched benchmarks


Comparing andretorresdg:fprint-error-names-file (2acdbeb) with main (0c8ef51)

Open in CodSpeed

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.

find: -fprint/-fprint0/-fprintf/-fls open errors don't say which file

1 participant