8000 head: improve error mgmt. by sylvestre · Pull Request #7408 · uutils/coreutils · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

head: improve error mgmt. #7408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 7, 2025
Merged

head: improve error mgmt. #7408

merged 2 commits into from
Mar 7, 2025

Conversation

sylvestre
Copy link
Contributor

And provide more details than GNU

Should fix tests/head/head-write-error

@sylvestre sylvestre requested a review from Copilot March 6, 2025 21:39
Copy link
@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

PR Overview

This pull request improves error management for the head utility by providing more descriptive error messages and ensuring consistent error mapping during output operations.

  • Updates the error message in the test to include context about standard output errors
  • Introduces a new helper function, map_stdout_error, to wrap and format errors consistently
  • Applies map_stdout_error mapping to both copy and flush operations in relevant functions

Reviewed Changes

File Description
tests/by-util/test_head.rs Updates expected error message for write failures
src/uu/head/src/head.rs Adds map_stdout_error function and applies it to error handling calls

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

Comments suppressed due to low confidence (2)

tests/by-util/test_head.rs:809

  • The updated error message now includes additional context regarding standard output errors. Verify that this message is consistent with error wording elsewhere in the application.
                .stderr_contains("error writing 'standard output': No space left on device");

src/uu/head/src/head.rs:246

  • [nitpick] Consider inlining map_stdout_error (e.g. with #[inline]) to potentially reduce function call overhead for this trivial error mapping function.
fn map_stdout_error(err: io::Error) -> io::Error {

Copy link
github-actions bot commented Mar 6, 2025

GNU testsuite comparison:

Congrats! The gnu test tests/head/head-write-error is no longer failing!

@sylvestre sylvestre requested review from cakebaker and RenjiSann March 7, 2025 06:56
Copy link
github-actions bot commented Mar 7, 2025

GNU testsuite comparison:

Skip an intermittent issue tests/misc/stdbuf (fails in this run but passes in the 'main' branch)
Skip an intermittent issue tests/timeout/timeout (fails in this run but passes in the 'main' branch)
Congrats! The gnu test tests/head/head-write-error is no longer failing!

And provide more details than GNU

Should fix tests/head/head-write-error
@sylvestre sylvestre merged commit 2ae14a3 into uutils:main Mar 7, 2025
65 of 66 checks passed
sylvestre added a commit that referenced this pull request Mar 7, 2025
sylvestre added a commit to sylvestre/coreutils that referenced this pull request Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
< 453F div class="discussion-sidebar-item sidebar-progress-bar js-discussion-sidebar-item js-socket-channel js-updatable-content" data-channel="eyJjIjoicHVsbF9yZXF1ZXN0OjIzNzcyNzg5NTUiLCJ0IjoxNzQ4MDYyNTU1fQ==--58f67d0047d383bc35b93b88e6861aae4741f5b21116e92530538285f3efb15a" data-gid="PR_kwDOALTHTM6NsmXr" data-url="/uutils/coreutils/issues/7408/show_partial?partial=issues%2Fsidebar%2Fshow%2Fmilestone" data-channel-event-name="milestone_updated" >
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
0