Mola-maker opened a new pull request, #9083:
URL: https://github.com/apache/opendal/pull/9083
# Which issue does this PR close?
Closes #9082.
# Rationale for this change
`list("dir/")` on ftp never returns `dir/` itself, unlike fs, sftp and the
other services. As a result, an empty directory lists as nothing, and the
`test_list_empty_dir`, `test_list_nested_dir` and `test_list_rich_dir` behavior
tests fail.
# What changes are included in this PR?
- `FtpLazyLister` emits a DIR entry for the listed path before its children,
for paths that end in `/` (except `/`), when the directory exists:
- A LIST that returns any entry proves the directory exists.
- An empty LIST is confirmed by listing the parent on the same connection
and looking for a directory with that name. Some servers return an empty
success for LIST on a missing path, so an empty LIST alone is not proof. If the
parent cannot be listed, the directory stays unconfirmed and the listing
behaves as before.
- Add `FtpLister::with_dir_entry` and a unit test for it.
Verification (Windows 11, rustc 1.99.1):
- `cargo test -p opendal-service-ftp --lib`: 12 passed.
- `cargo clippy -p opendal-service-ftp --all-targets -- -D warnings`: clean
on Windows. I could not run Linux cross-target clippy, because ring needs a C
cross-compiler.
- ftp behavior tests against OpenDAL's `unftp-sbe` on Fs: 105 → 108 passed.
All 3 list tests now pass, and `test_list_non_exist_dir` still passes. The 10
remaining failures are ranged reads, because unftp-sbe rejects `REST`
(`restart_is_unsupported`).
# Are there any user-facing changes?
Listing an existing ftp directory now returns the directory itself first, as
other services do.
# Breaking changes
# AI Usage Statement
- Harness: Claude Code
- Model: Anthropic Claude
- Effort: default
- Role: Found the bug by running the ftp behavior suite against OpenDAL's
`unftp-sbe` server, wrote the fix and the test, and ran the checks above. A
separate review pass checked root and relative-path handling and the recursive
listing simulation. Following that review, a parent LIST that fails no longer
fails the listing.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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]