Skip to content

xargs: strip errno when arg-file doesn't exist - #811

Closed
Devel08 wants to merge 1 commit into
uutils:mainfrom
Devel08:patch-1
Closed

Devel08 wants to merge 1 commit into
uutils:mainfrom
Devel08:patch-1

Conversation

@Devel08

@Devel08 Devel08 commented Aug 5, 2026

Copy link
Copy Markdown
$ cargo run --bin xargs -- --arg-file sdf
   Compiling findutils v0.10.0 (/home/devel/Desktop/findutils)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.42s
     Running `target/debug/xargs --arg-file sdf`
Error: Failed to open sdf: No such file or directory (os error 2)

this PR gets rid of the (os error 2) in the message

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.90%. Comparing base (1f19cdd) to head (ac0171f).

Files with missing lines Patch % Lines
src/xargs/mod.rs 66.66% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #811      +/-   ##
==========================================
- Coverage   91.93%   91.90%   -0.03%     
==========================================
  Files          35       35              
  Lines        7251     7254       +3     
  Branches      378      378              
==========================================
+ Hits         6666     6667       +1     
- Misses        443      445       +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.

@codspeed

codspeed Bot commented Aug 5, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 20 untouched benchmarks


Comparing Devel08:patch-1 (ac0171f) with main (1f19cdd)

Open in CodSpeed

@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Commit ac0171f has test result changes:

bfs testsuite:

Test results comparison:
  Current:   TOTAL: 316 / PASSED: 267 / FAILED: 43 / SKIPPED: 6
  Reference: TOTAL: 312 / PASSED: 266 / FAILED: 40 / SKIPPED: 6

Changes from main branch:
  TOTAL: +4
  PASSED: +1
  FAILED: +3

New test failures (3):
  - gnu/files0_from_ok
  - gnu/okdir_path_empty
  - gnu/okdir_path_relative

sylvestre pushed a commit to sylvestre/findutils that referenced this pull request Aug 10, 2026
* xargs: strip `(os error N)` from --arg-file open failure

When --arg-file points at a missing path, xargs used to surface the raw
io::Error display, which appends " (os error N)" for OS errors:

    Error: Failed to open sdf: No such file or directory (os error 2)

GNU xargs omits that detail. Reuse uucore::error::strip_errno (already
used by updatedb) so the message reads:

    Error: Failed to open sdf: No such file or directory

Closes uutils#811

* test: make xargs_arg_file_missing_strips_errno cross-platform

The assertion hardcoded the Unix errno wording ("No such file or
directory"), so the test failed on Windows where the OS reports
"The system cannot find the path specified." (reported by @sylvestre).

The contract this test guards is only that the trailing "(os error N)"
suffix is stripped — the OS wording is out of our control. Assert the
portable parts instead: our "Failed to open <path>:" wrapper names the
path and no "(os error" suffix leaks.
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.

1 participant