+
Skip to content

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 RenjiSann and cakebaker 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
@sylvestre sylvestre deleted the head-error branch July 28, 2025 14:49
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.

3 participants

点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载