Context
hosted_dir_list currently discards errors produced while iterating an otherwise successfully opened directory:
let entries = read_dir
.filter_map(|entry| entry.ok().map(|entry| entry.path()))
.collect();
See src/lib.rs:1173-1177.
This can return an incomplete list as Ok when an entry disappears during iteration or the filesystem reports an I/O error. Because Path.list! already returns a Try, silently returning partial data is surprising and can lead applications to make incorrect decisions.
Suggested direction
Collect the iterator as a Result<Vec<_>, io::Error> and map the first entry error through the existing directory error conversion. If partial results are considered useful, expose them through a deliberately different API and result type.
Acceptance criteria
- An error from any
ReadDir entry is not silently dropped.
Path.list! returns either a complete snapshot-like result or a typed error.
- Tests exercise the error branch through a controllable abstraction or filesystem race harness.
- Existing success and non-directory cases continue to pass on Unix and Windows.
Context
hosted_dir_listcurrently discards errors produced while iterating an otherwise successfully opened directory:See
src/lib.rs:1173-1177.This can return an incomplete list as
Okwhen an entry disappears during iteration or the filesystem reports an I/O error. BecausePath.list!already returns aTry, silently returning partial data is surprising and can lead applications to make incorrect decisions.Suggested direction
Collect the iterator as a
Result<Vec<_>, io::Error>and map the first entry error through the existing directory error conversion. If partial results are considered useful, expose them through a deliberately different API and result type.Acceptance criteria
ReadDirentry is not silently dropped.Path.list!returns either a complete snapshot-like result or a typed error.