Skip to content

async: Don't reply to a channel EOF with our own EOF - #85

Merged
mkj merged 1 commit into
mkj:mainfrom
microtun:fix/channel-eof
Nov 29, 2026
Merged

mkj merged 1 commit into
mkj:mainfrom
microtun:fix/channel-eof

Conversation

@dpeckett

Copy link
Copy Markdown
Contributor

Receiving CHANNEL_EOF made sunset send its own EOF right away. EOF only ends the peer's direction (RFC 4254 5.3), so anything the application wrote after reading to EOF was sent after our EOF: OpenSSH discards it. That loses the output of ssh host cmd < /dev/null, cat f | ssh host cmd, or any command that reads stdin to EOF before answering. Writes were also still accepted after our EOF, putting data on the wire that the peer must ignore.

Since f3fd0a5 closing a channel or dropping all its handles sends EOF and Close, so channels still terminate without the automatic reply.

@dpeckett

dpeckett commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor Author

Partial dupe of #77, and #44

Comment thread async/src/async_channel.rs Resolved
Receiving CHANNEL_EOF made sunset send its own EOF right away. EOF only
ends the peer's direction (RFC 4254 5.3), so anything the application
wrote after reading to EOF was sent after our EOF: OpenSSH discards it.
That loses the output of `ssh host cmd < /dev/null`, `cat f | ssh host
cmd`, or any command that reads stdin to EOF before answering. Writes
were also still accepted after our EOF, putting data on the wire that
the peer must ignore.

Since f3fd0a5 closing a channel or dropping all its handles sends EOF
and Close, so channels still terminate without the automatic reply.
@mkj
mkj merged commit 23a2c01 into mkj:main Nov 29, 2026
2 checks passed
@mkj

mkj commented Nov 29, 2026

Copy link
Copy Markdown
Owner

Thanks for these fixes.

The channel EOF handling here resolves part of #22

@dpeckett

dpeckett commented Nov 29, 2026 •

Copy link
Copy Markdown
Contributor Author

Thanks so much for all your prompt reviews, that's the last of my patch series for now 👋.

Inter-operating with sunset-sftp via openssh's scp client should now be possible.

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.

2 participants