nntp: test article payload whitespace preservation - #367
Draft
OllieinCanada wants to merge 2 commits into
Draft
Conversation
Signed-off-by: OllieinCanada <73385593+OllieinCanada@users.noreply.github.com>
Signed-off-by: OllieinCanada <73385593+OllieinCanada@users.noreply.github.com>
davidehu-69
added a commit
to davidehu-69/sashiko
that referenced
this pull request
Jul 29, 2026
Preserve trailing spaces and tabs when reading NNTP lines by replacing generic trim_end() with trim_end_matches(['\r', '\n']). Stripping trailing whitespace corrupts patch diff hunks and causes git apply to fail. Fix RFC 3977 dot-unstuffing to strip leading periods on non-terminator lines starting with '.', and return an explicit error on premature EOF. Sanitize newlines in email display names to prevent lettre builder panics. Tested manually by replaying patch diffs containing exact tabs, trailing spaces, and dot-prefixed filenames (.gitignore) against git apply. Closes: sashiko-dev#367 Signed-off-by: Davide Hu <davidehu@google.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up regression coverage for #320.
Summary
Add a deterministic localhost mock-server test for the NNTP article payload
whitespace fix merged in
c3b5584.While this pull request was still a draft, upstream merged the production fix
and closed #320. The branch has therefore been updated to current
main, andthe duplicate implementation was removed. The cumulative diff now contains
only regression coverage for the accepted behavior.
Coverage
The test exercises the real
NntpClient::article()path and verifies:The mock server binds only to an ephemeral localhost port, verifies the
ARTICLEcommand, and is awaited so server-task failures cannot be hidden.Validation
cargo fmt --all -- --checkcargo clippy --all-targets --all-features --release -- -D warningsexcluding the known old-Git portability test tracked by tests: make bad-tag recovery test portable across Git versions #350
git diff --checkmake check-pr RANGE=upstream/main..HEADcompleted formatting and clippysuccessfully; its unfiltered local test phase encountered only the known #350
failure with Git 2.25.1.
No external NNTP server, kernel checkout, LLM, paid API, database, or Docker
container is required.