Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@sylvestre
Copy link
Contributor

No description provided.

@codspeed-hq
Copy link

codspeed-hq bot commented Jan 18, 2026

CodSpeed Performance Report

Merging this PR will improve performance by 3.32%

Comparing sylvestre:followup-9437 (639d2f8) with main (a0a797d)

Summary

⚡ 1 improved benchmark
✅ 281 untouched benchmarks
⏩ 38 skipped benchmarks1

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory dd_copy_partial 133.4 KB 129.1 KB +3.32%

Footnotes

  1. 38 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.

/// Logs a warning if fcntl fails but doesn't abort the operation.
#[cfg(any(target_os = "linux", target_os = "android"))]
fn open_and_reset_nonblock(path: &str) -> UResult<File> {
let f = File::open(path).map_err_context(|| path.to_string())?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Theres a bunch of issues with the current implementation, but it depends what is in scope for this PR?

The File::open

You can replicate this with:

mkfifo /tmp/testfifo
timeout 2 sync --data /tmp/testfifo

GNU will fail immediately and uutils with timeout

Copy link
Collaborator

Choose a reason for hiding this comment

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

I implemented a fix for this here: https://github.com/uutils/coreutils/blob/main/src/uu/tail/src/tail.rs#L224 maybe we should make it a shared library and reuse it here

let f = File::open(&path).map_err_context(|| path.clone())?;
// Reset O_NONBLOCK flag if it was set (matches GNU behavior)
let _ = fcntl(&f, FcntlArg::F_SETFL(OFlag::empty()));
let f = open_and_reset_nonblock(&path)?;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The other issue is that GNU goes through all inputs and sets the error code to 0 if any fail, but here it exits after the first one.

For when bad1 and bad2 do not exist:

sync --data bad1 bad2

GNU shows:

     sync: error opening 'bad1': No such file or directory
     sync: error opening 'bad2': No such file or directory

And uutils only has:

     sync: error opening 'bad1': No such file or directory

Copy link
Collaborator

Choose a reason for hiding this comment

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

Probably want to make an integ test for both of the usecases that are not matching

@ChrisDryden
Copy link
Collaborator

ChrisDryden commented Jan 28, 2026

@sylvestre how would you feel if we just merge these as is and follow up with the GNU deviations in follow up PR's? Each of these issues exist beforehand. Then even when adding integ tests for those two scenarios the PR's will be easier to review and merge?

Similar to this one where the PR fixes deviations and is correct its just that there's additional things to fix, #10300 but would be easier to address them in follow ups with smaller scope

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.

2 participants