Skip to content

Treat local path objects as paths while retaining IO behavior - #85

Open
OskarEichler wants to merge 1 commit into
net-ssh:masterfrom
OskarEichler:codex/normalize-local-paths
Open

Treat local path objects as paths while retaining IO behavior#85
OskarEichler wants to merge 1 commit into
net-ssh:masterfrom
OskarEichler:codex/normalize-local-paths

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Normalize local path-protocol objects before selecting the upload/download IO path. Keep real File/IO objects as streams, including their current positions and caller ownership.

Reproduction and evidence

Closes #29. With a Pathname source, a six-byte upload in three-byte chunks repeatedly rereads the first chunk and never completes; a bounded 30-transition simulation reproduces it. A Pathname destination receiving abc, then def, retains only def because Pathname#write reopens the file. Both public-entrypoint simulations pass after this patch. Combined release integration also transfers binary files both ways through local /usr/bin/scp processes.

Compatibility / breaking changes

No version/dependency change. Objects implementing to_path but not to_io are treated as paths. File/IO objects with to_io retain streaming behavior. Custom objects that deliberately implemented both to_path and read/write without to_io will now be treated as paths.

Verification and limits

  • This focused branch passes the existing upstream suite: 36 tests / 70 assertions, Ruby 4.0.6, net-ssh 7.3.3, test-unit 3.7.8 and Mocha 2.1.0; all Ruby commands used rbenv.
  • The combined release-based consumer candidate passes the suite with frozen string literals enabled, 10 focused cases, 2,906 model assertions, 24 URI-component assertions and 19 local scp/URI assertions. Combined evidence includes other separately proposed fixes and existing upstream frozen-string corrections; it is not attributed to this patch alone.
  • No repository tests added/modified under the consuming project's explicit no-new-tests policy. Reproductions/models ran externally. No deployed servers, SSH connections or production data were used.
  • All seven runtime files parse with the Ruby 2.6 parser; actual older-Ruby/Windows/remote-server matrices were not run locally. No upstream lint config exists; targeted lint has the same eight pre-existing warnings, with no new warnings.
  • Existing upstream PRs/issues and contribution guidance were checked. Maintainer CI results are pending; no CI pass is claimed.

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.

Passing in a Pathname object as local for download! fails

1 participant