You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@opendal.apache.org by xu...@apache.org on 2026/07/23 12:25:38 UTC
(opendal) branch main updated: feat(core): not translate to "interrupted" std IO error (#7940)
This is an automated email from the ASF dual-hosted git repository.
Xuanwo pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/opendal.git
The following commit(s) were added to refs/heads/main by this push:
new aab4bda0d feat(core): not translate to "interrupted" std IO error (#7940)
aab4bda0d is described below
commit aab4bda0daaf99a45cbc855747bb1419ca8efd92
Author: dentiny <de...@gmail.com>
AuthorDate: Thu Jul 23 05:25:32 2026 -0700
feat(core): not translate to "interrupted" std IO error (#7940)
---
core/core/src/raw/std_io_util.rs | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/core/core/src/raw/std_io_util.rs b/core/core/src/raw/std_io_util.rs
index 98510d7c5..3fa9f0487 100644
--- a/core/core/src/raw/std_io_util.rs
+++ b/core/core/src/raw/std_io_util.rs
@@ -58,8 +58,40 @@ pub(crate) fn format_std_io_error(err: Error) -> io::Error {
let kind = match err.kind() {
ErrorKind::NotFound => io::ErrorKind::NotFound,
ErrorKind::PermissionDenied => io::ErrorKind::PermissionDenied,
- _ => io::ErrorKind::Interrupted,
+ _ => io::ErrorKind::Other,
};
io::Error::new(kind, err)
}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn test_read_to_end_stops_on_persistent_error() {
+ struct ErrorThenEof {
+ calls: usize,
+ }
+
+ impl io::Read for ErrorThenEof {
+ fn read(&mut self, _: &mut [u8]) -> io::Result<usize> {
+ self.calls += 1;
+ if self.calls == 1 {
+ return Err(format_std_io_error(
+ Error::new(ErrorKind::Unexpected, "retry exhausted").set_persistent(),
+ ));
+ }
+ Ok(0)
+ }
+ }
+
+ let mut reader = ErrorThenEof { calls: 0 };
+ let mut buf = Vec::new();
+ assert!(
+ io::Read::read_to_end(&mut reader, &mut buf).is_err(),
+ "calls: {}",
+ reader.calls
+ );
+ }
+}