Repository navigation
feat(protocol): apply FilenameConverter on sender flist emit (#1912) - #3548
Merged
Merged
Conversation
oferchen
marked this pull request as ready for review
May 1, 2026 22:13
Wires the existing `apply_encoding_conversion` hook on the sender's file-list emit path so filenames are transcoded from local to remote charset before any prefix-compression bookkeeping or wire emission when --iconv=remote,local is in effect. The producer wiring tracker in `crates/engine/src/local_copy/options/filters.rs` (#1911) named this gap explicitly, and the SSH/daemon producer in `transfer::generator::build_flist_writer` already calls `writer.with_iconv(...)` from `connection.iconv`, so the hook now takes effect end-to-end whenever the runtime config carries a resolved converter. Changes: - Annotate the iconv conversion call site in `FileListWriter::write_entry` with the upstream reference `flist.c send_file_entry() iconv_buf(ic_send, ...)` so the protocol-fidelity contract is visible at the wire boundary. - Mirror `FileListWriter::with_iconv` on `BatchedFileListWriter` so the batched sender path can attach a converter through the same builder surface. - Add unit tests in `crates/protocol/src/flist/write/tests.rs` covering the with-converter round-trip (UTF-8 source name -> wire bytes are ISO-8859-1, no UTF-8 multi-byte sequence remains) and the without-converter path (wire bytes match the original filename, preserving current behaviour). upstream: flist.c send_file_entry() iconv_buf(ic_send, ...) audit: docs/audits/iconv-pipeline.md, Finding 4
oferchen
force-pushed
the
feat/iconv-sender-emit-1912
branch
from
May 2, 2026 01:28
8116e49 to
8ad5cbf
Compare
oferchen
added a commit
that referenced
this pull request
May 5, 2026
…3548) Wires the existing `apply_encoding_conversion` hook on the sender's file-list emit path so filenames are transcoded from local to remote charset before any prefix-compression bookkeeping or wire emission when --iconv=remote,local is in effect. The producer wiring tracker in `crates/engine/src/local_copy/options/filters.rs` (#1911) named this gap explicitly, and the SSH/daemon producer in `transfer::generator::build_flist_writer` already calls `writer.with_iconv(...)` from `connection.iconv`, so the hook now takes effect end-to-end whenever the runtime config carries a resolved converter. Changes: - Annotate the iconv conversion call site in `FileListWriter::write_entry` with the upstream reference `flist.c send_file_entry() iconv_buf(ic_send, ...)` so the protocol-fidelity contract is visible at the wire boundary. - Mirror `FileListWriter::with_iconv` on `BatchedFileListWriter` so the batched sender path can attach a converter through the same builder surface. - Add unit tests in `crates/protocol/src/flist/write/tests.rs` covering the with-converter round-trip (UTF-8 source name -> wire bytes are ISO-8859-1, no UTF-8 multi-byte sequence remains) and the without-converter path (wire bytes match the original filename, preserving current behaviour). upstream: flist.c send_file_entry() iconv_buf(ic_send, ...) audit: docs/audits/iconv-pipeline.md, Finding 4
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
apply_encoding_conversionhook on the sender's file-list emit path so filenames are transcoded from local to remote charset before prefix-compression bookkeeping and wire emission when--iconv=remote,localis in effect.FileListWriter::write_entrywith the upstream referenceflist.c send_file_entry() iconv_buf(ic_send, ...)so the protocol-fidelity contract is visible at the wire boundary.FileListWriter::with_iconvonBatchedFileListWriterso the batched sender path can attach a converter through the same builder surface.Why
The audit at
docs/audits/iconv-pipeline.md(Finding 4) flagged that the conversion helper existed but no production caller emitted converted bytes. PR #1911 (feat(core): wire IconvSetting to FilenameConverter at config build) plumbed the resolved converter intotransfer::ConnectionConfig::iconvandengine::LocalCopyOptions::iconv, andtransfer::generator::build_flist_writeralready callswriter.with_iconv(...)fromconnection.iconv. With this change, the hook now takes effect end-to-end whenever the runtime config carries a resolved converter, so--iconvstops being a silent no-op for sender flist emit.The follow-ups for receiver ingest (#1913) and filter-rule path matching (#1914) remain tracked separately.
Tests
crates/protocol/src/flist/write/tests.rs::write_entry_transcodes_filename_with_iconv_to_remote_charset(feature-gatediconv): asserts that a UTF-8 source name"café.txt"emerges on the wire as the ISO-8859-1 byte sequence[0x63, 0x61, 0x66, 0xe9, 0x2e, 0x74, 0x78, 0x74]and that the UTF-8 form ofé(0xc3 0xa9) does not appear.crates/protocol/src/flist/write/tests.rs::write_entry_without_iconv_emits_raw_filename_bytes: asserts the no-converter path still emits raw filename bytes unchanged, preserving current behaviour.Test plan
Upstream
target/interop/upstream-src/rsync-3.4.1/flist.clines 1579-1603,send_file_entry()filenameiconvbufs(ic_send, ...)(dirname + '/' + basename).Tracker: #1912.