Skip to content

Conversation

@ChrisDryden
Copy link
Collaborator

@ChrisDryden ChrisDryden commented Dec 24, 2025

The dd/skip-seek-past-file test is checking that the default implementation uses skip as the reader by putting a set of inputs that would cause an out of bounds read if skip was not used, but for things like pipe inputs using copy is the right approach to use and we have other GNU tests that rely on that behaviour. This PR uses skip as the default then falls back to copy.

@github-actions
Copy link

GNU testsuite comparison:

Congrats! The gnu test tests/dd/skip-seek-past-file is no longer failing!

}
Ok(pos)
}
Some(Err(e)) if e.raw_os_error() == Some(libc::ESPIPE) => {
Copy link
Contributor

@asder8215 asder8215 Dec 24, 2025

Choose a reason for hiding this comment

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

I usually prefer using e.kind() over e.raw_os_error(). Is there a reason to use libc::ESPIPE over std::io::NotSeekable?

Edit: Realized that std::io::NotSeekable might not be the equivalent code for this on documentation

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, is lib::ESPIPE not equivalently supported through Rust's ErrorKind?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm unsure what the difference is between the two, I can try it out now to see if it still passes all of the tests

Copy link
Contributor

Choose a reason for hiding this comment

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

There isn't a difference between using libc's errors or Rust's ErrorKind; I just thought it looks a bit more idiomatic relying on Rust's ErrorKind over libc's errno values.

But I think this is one of those cases where libc::ESPIPE might fall under Rust's std::io::Other error, which isn't that descriptive.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yea this one is not the equivalent, the stable ErrorKind does not have a matching variant for this use case.

@ChrisDryden ChrisDryden marked this pull request as ready for review December 24, 2025 16:38
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