chitralverma opened a new pull request, #8967:
URL: https://github.com/apache/opendal/pull/8967
# Which issue does this PR close?
Closes #8965.
# Rationale for this change
The guided glob walk lists each directory it discovers itself, so one
unreadable subdirectory fails the whole `list_with(..).glob(..)` call with
`PermissionDenied`. A recursive listing of the same tree skips that directory
with a warning (fs lister, `SimulateLayer`), so glob should behave the same way.
# What changes are included in this PR?
- `GlobLayer`'s guided walk records whether each `Directory` was discovered
while listing a parent or was the starting directory.
- `PermissionDenied` on a discovered directory is skipped with `log::warn!`,
next to the existing `NotFound`/`NotADirectory` handling. The starting
directory still returns the error, matching recursive listing.
- Tests:
-
`layers::glob::tests::guided_listing_skips_unreadable_discovered_directories`:
a fixture service that denies one discovered directory. Also asserts that
listing the denied directory directly still errors.
- `services/fs` `glob_skips_unreadable_child`: end-to-end on the real fs
service with a mode-000 directory, for `data/**/*.jpg` and `data/*/*.jpg`, plus
the direct-listing error. It returns early when run as root, like the existing
`list_recursively_skips_unreadable_child`.
Both new tests fail on `main` and pass with this change.
Verification on macOS (non-root):
- `cargo test --lib` in `core/core`: 490 passed.
- `cargo test` in `core/services/fs`: 30 passed.
- Behavior `list` tests with `OPENDAL_TEST=fs` and `OPENDAL_TEST=memory`:
20/20 each.
- `cargo clippy --all-targets -- -D warnings` for core (all features) and fs.
- `cargo fmt --all --check`.
- The reproduction from the issue now prints `Ok(["data/ok/a.parquet"])` for
both patterns.
# Are there any user-facing changes?
Yes. A glob listing no longer fails when it discovers a subdirectory it
cannot read. It skips that directory and logs a warning, as recursive listing
already does. Errors for the directory passed to `list_with` are unchanged.
# Breaking changes
# AI Usage Statement
- Harness: Jcode
- Model: claude-opus-5-5
- Effort: low
- Role: Found the problem while evaluating glob listing, wrote the patch,
tests and this description, and ran the verification listed above. The human
author reviewed the change and the results.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]