feat(protocol): apply FilenameConverter on receiver flist ingest (#1913)#3546
Merged
Conversation
Annotate the receiver flist ingest path so it explicitly references upstream `flist.c recv_file_entry() iconv_buf(ic_recv, ...)` and adds regression tests that exercise the wire-to-local conversion through `FileListReader`. Wire bytes hit `apply_encoding_conversion` after `read_name` updates the prefix-compression buffer, mirroring upstream's `lastname` semantics where the static buffer holds the unconverted wire bytes so subsequent entries share the prefix as the sender intended. The new tests cover: - ISO-8859-1 wire bytes decoded to UTF-8 with `--iconv=UTF-8,ISO-8859-1` - pass-through when no converter is configured - identity converter is a no-op Refs #1913.
baa434c to
459616d
Compare
oferchen
added a commit
that referenced
this pull request
May 5, 2026
…) (#3546) Annotate the receiver flist ingest path so it explicitly references upstream `flist.c recv_file_entry() iconv_buf(ic_recv, ...)` and adds regression tests that exercise the wire-to-local conversion through `FileListReader`. Wire bytes hit `apply_encoding_conversion` after `read_name` updates the prefix-compression buffer, mirroring upstream's `lastname` semantics where the static buffer holds the unconverted wire bytes so subsequent entries share the prefix as the sender intended. The new tests cover: - ISO-8859-1 wire bytes decoded to UTF-8 with `--iconv=UTF-8,ISO-8859-1` - pass-through when no converter is configured - identity converter is a no-op Refs #1913.
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.
Summary
--iconvingest path that convertswire-charset filenames into local-charset bytes via
FilenameConverterbefore storage in
FileEntry.FileListReader::read_entry_with_flist()and onapply_encoding_conversionitself.
pass-through with no converter, and identity-converter no-op.
Why
The wire-to-local conversion was wired through
FileListReader::with_iconvplus
apply_encoding_conversion, but lacked an upstream-referencing call-sitecomment and any direct unit test that exercises non-ASCII wire bytes through
FileListReader::read_entry. This change documents the contract and locks inthe behaviour with tests so a future refactor cannot silently drop the
conversion without a test failure.
The conversion order (read_name -> update prefix-compression state with wire
bytes -> apply iconv -> clean_fname) mirrors upstream
flist.c:738-754,where
lastnameintentionally retains the unconverted wire bytes sosubsequent entries share the prefix as the sender intended.
Upstream Reference
flist.c:738-754recv_file_entry()runs the freshly-read filename throughiconvbufs(ic_recv, ...)beforeclean_fname().Refs #1913.
Test plan
cargo fmt --all -- --checkcargo clippy -p protocol --all-features -- -D warningscargo clippy -p protocol --all-features --tests -- -D warningsiconv_integrationtest module