Skip to content

feat(services/sftp): allow setting control_directory - #8626

Merged
Xuanwo merged 2 commits into
apache:mainfrom
Mola-maker:fix/3963-sftp-control-directory
Nov 22, 2026
Merged

Xuanwo merged 2 commits into
apache:mainfrom
Mola-maker:fix/3963-sftp-control-directory

Conversation

@Mola-maker

@Mola-maker Mola-maker commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Closes #3963

Rationale for this change

The SFTP backend offers no way to set the SSH control directory.
The old code defaulted it to the runtime directory, which is not always suitable.

What changes are included in this PR?

  • Added a control_directory option to SftpConfig and SftpBuilder.
  • The option is passed to the SSH session when a connection is created.
  • The default is unchanged: $XDG_STATE_HOME or $HOME/.local/state, falling back to the current directory.

Note: #7977 ports sftp from openssh to russh and touches the same files.
This may need a rebase if that lands first.

Are there any user-facing changes?

Yes. Users can now set the directory holding the SSH control socket.

Test

  • cargo test -p opendal-service-sftp --lib: 11 passed, 0 failed.
  • The option does not exist on the base, so the new tests only run with the fix.
  • cargo clippy -p opendal-service-sftp --all-targets --all-features: clean.
  • cargo fmt --all -- --check: clean.
  • No live SFTP test was run. There is no SFTP server here.

AI Usage Statement

  • Harness: Muse
  • Model: Muse Spark
  • Effort: default
  • Role: Muse drafted the investigation, fix, and tests under my direction; I reviewed the diff and ran the tests.

Screenshots

Before the fix

3963-before

After the fix

3963-after

Test suites

3963-suites

@Mola-maker
Mola-maker requested a review from Xuanwo as a code owner November 22, 2026 03:11

@Xuanwo Xuanwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review.

The Rust SftpConfig.control_directory wiring and SFTP behavior tests look good. The only remaining blocker is check_generated failing on 794075d8 because adding a field to SftpConfig updates four generated files:

  • bindings/dotnet/OpenDAL/ServiceConfig/SftpServiceConfig.cs
  • bindings/java/src/main/java/org/apache/opendal/ServiceConfig.java
  • bindings/python/python/opendal/config.py
  • website/data/services.json

Could you run the config generators and commit those regenerated files so check_generated passes? (Failing job: https://github.com/apache/opendal/actions/runs/44979486979/job/137076631244)

@Xuanwo Xuanwo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated review.

Thanks for adding control_directory and updating the generated configs. LGTM!

@Xuanwo
Xuanwo merged commit 6365e64 into apache:main Nov 22, 2026
123 of 124 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

services/sftp: Allow setting control_directory

2 participants