You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
bug: incorrect Display implementation for BytesRange #8386
In the Display::fmt implementation for ByteRange, some match arms return an error, which is not allowed and causes the panic below.
Steps to Reproduce
use opendal::BytesRange;println!("{}",BytesRange::Range{ offset:0, size:Some(0)}");
Actual Behavior
thread 'main' (84429) panicked at /rustc/59807616e1fa2540724bfbac14d7976d7e4a3860/library/std/src/io/mod.rs:648:17:
a formatting trait implementation returned an error when the underlying stream did not
Expected Behavior
no panic
Additional Context
No response
Reproduction confirmation
I reproduced this issue against the affected component. For a service-specific report, I used the actual service rather than only a mock, emulator, or source-code analysis.
Hey @zqianem, I'd like to take this one and send a PR.
Display for BytesRange returns an error for a zero-size range and on offset+size overflow, which makes format! panic. My plan is to render a valid string for those cases instead of returning Err, and add unit tests for both. I'll look at #8343 first so we don't overlap.
Sure, go for it (I wasn't planning on a PR; no need to ask me for permission).
One thing to keep in mind is that it seems like that the Display implementation is being used to create the HTTP range requests, so perhaps this logic needs to be split between general Displaying and outputting a valid range request.
(I don't really know anything about this codebase though, so defer to the maintainers if you have any questions.)
Generally you shouldn't ping the maintainers of a repository — they will see this issue and/or your PR eventually.
It doesn't seem like GitHub has a place to see all the maintainers but if they comment on an issue or PR, they will have a "Member" badge next to their name (like how I have an "Author" badge when I comment in this issue).
Activity
akshat-lakhera commentedon Oct 11, 2026
Hey @zqianem, I'd like to take this one and send a PR.
Display for BytesRange returns an error for a zero-size range and on offset+size overflow, which makes format! panic. My plan is to render a valid string for those cases instead of returning Err, and add unit tests for both. I'll look at #8343 first so we don't overlap.
zqianem commentedon Oct 11, 2026
Sure, go for it (I wasn't planning on a PR; no need to ask me for permission).
One thing to keep in mind is that it seems like that the
Displayimplementation is being used to create the HTTP range requests, so perhaps this logic needs to be split between generalDisplaying and outputting a valid range request.(I don't really know anything about this codebase though, so defer to the maintainers if you have any questions.)
akshat-lakhera commentedon Oct 12, 2026
Thanks @zqianem, I would consider your point while implementing,
Can you le me know tell are the maintainer of this org so I can ping then up.
zqianem commentedon Oct 12, 2026
Generally you shouldn't ping the maintainers of a repository — they will see this issue and/or your PR eventually.
It doesn't seem like GitHub has a place to see all the maintainers but if they comment on an issue or PR, they will have a "Member" badge next to their name (like how I have an "Author" badge when I comment in this issue).