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 c904b586d fix(core): skip PermissionDenied errors in recursive lister
(#7096)
c904b586d is described below
commit c904b586de22a2b77f089cef2e6dd2135d64f18e
Author: userzhy <[email protected]>
AuthorDate: Wed Jan 21 16:58:34 2026 +0800
fix(core): skip PermissionDenied errors in recursive lister (#7096)
* fix(core): skip PermissionDenied errors in recursive lister
When using a recursive lister and encountering a PermissionDenied
error while accessing a protected directory, the lister should skip
the inaccessible directory and continue returning entries from other
accessible directories.
Previously, FlatLister would immediately propagate the PermissionDenied
error, causing the entire iteration to terminate prematurely.
This fix changes the behavior to gracefully skip directories that
cannot be accessed due to permission restrictions, allowing the
listing to continue until all accessible entries are exhausted.
Closes #7095
* fix(core): skip PermissionDenied errors in recursive lister
When using a recursive lister and encountering a PermissionDenied
error while accessing a protected directory, the lister should skip
the inaccessible directory and continue returning entries from other
accessible directories.
Previously, FlatLister would immediately propagate the PermissionDenied
error, causing the entire iteration to terminate prematurely.
This fix changes the behavior to gracefully skip directories that
cannot be accessed due to permission restrictions, allowing the
listing to continue until all accessible entries are exhausted.
A warning message is now logged when a directory is skipped due to
permission denied error.
Closes #7095
* ci: trigger CI re-run for flaky monoiofs test
---
core/core/src/raw/oio/list/flat_list.rs | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff --git a/core/core/src/raw/oio/list/flat_list.rs
b/core/core/src/raw/oio/list/flat_list.rs
index 6689664c7..69ff0edb5 100644
--- a/core/core/src/raw/oio/list/flat_list.rs
+++ b/core/core/src/raw/oio/list/flat_list.rs
@@ -92,7 +92,19 @@ where
async fn next(&mut self) -> Result<Option<oio::Entry>> {
loop {
if let Some(de) = self.next_dir.take() {
- let (_, mut l) = self.acc.list(de.path(),
OpList::new()).await?;
+ let (_, mut l) = match self.acc.list(de.path(),
OpList::new()).await {
+ Ok(v) => v,
+ Err(e) if e.kind() == ErrorKind::PermissionDenied => {
+ // Skip directories that we don't have permission to
access
+ // and continue with the rest of the listing.
+ log::warn!(
+ "FlatLister skipping directory due to permission
denied: {}",
+ de.path()
+ );
+ continue;
+ }
+ Err(e) => return Err(e),
+ };
if let Some(v) = l.next().await? {
self.active_lister.push((Some(de.clone()), l));