Skip to content

cut: strip i/o errno - #14060

Merged
sylvestre merged 9 commits into
uutils:mainfrom
Devel08:fix-issue-14051
Aug 21, 2026
Merged

cut: strip i/o errno#14060
sylvestre merged 9 commits into
uutils:mainfrom
Devel08:fix-issue-14051

Conversation

@Devel08

@Devel08 Devel08 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

closes #14051

run on linux
@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

GNU testsuite comparison:

Skip an intermittent issue tests/date/resolution (fails in this run but passes in the 'main' branch)
Note: The gnu test tests/rm/many-dir-entries-vs-OOM is now being skipped but was previously passing.
Congrats! The gnu test tests/cut/cut-huge-range is now passing!
Congrats! The gnu test tests/tail/tail-n0f is now passing!
Skip an intermittent issue tests/pr/bounded-memory (was skipped on 'main', now failing)

@Devel08

Devel08 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

really interesting why cargo tests cannot reproduce that

$ cargo run cut -c1 /proc/self/mem
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.13s
     Running `target/debug/coreutils cut -c1 /proc/self/mem`
cut: Input/output error

@codspeed-hq

codspeed-hq Bot commented Aug 21, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 357 untouched benchmarks
⏩ 50 skipped benchmarks1


Comparing Devel08:fix-issue-14051 (a360b5e) with main (df30282)

Open in CodSpeed

Footnotes

  1. 50 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

@Devel08

Devel08 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

@cakebaker what cargo test returns is different than when the same command it uses is ran manually, what can be the cause?

@Devel08

Devel08 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor Author

turns out we had to strip errno for both chars and bytes :D

@Devel08
Devel08 marked this pull request as ready for review August 21, 2026 13:28
Comment thread tests/by-util/test_cut.rs Outdated
Comment thread tests/by-util/test_cut.rs Outdated
Comment thread tests/by-util/test_cut.rs Outdated
.args(&["-c1", "/proc/self/mem"])
.fails_with_code(1);

let stderr = result.stderr_str();

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Use stderr_is instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks

Devel08 and others added 3 commits August 21, 2026 18:41
Co-authored-by: oech3 <79379754+oech3@users.noreply.github.com>
Co-authored-by: oech3 <79379754+oech3@users.noreply.github.com>
Comment thread src/uu/cut/src/cut.rs

if let Err(e) = result {
return Err(USimpleError::new(1, e.to_string()));
return Err(USimpleError::new(1, strip_errno(&e)));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can be different PR. But result.map_err(|_| ...)?;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I thought of the same, but let's simplify it later as I've seen it in other places too?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

yes

Comment thread tests/by-util/test_cut.rs Outdated
Co-authored-by: oech3 <79379754+oech3@users.noreply.github.com>
@sylvestre
sylvestre merged commit 5188b6f into uutils:main Aug 21, 2026
168 of 169 checks passed
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.

cut: unstripped i/o error

3 participants