Skip to content

feat(protocol): apply FilenameConverter on receiver flist ingest (#1913)#3546

Merged
oferchen merged 1 commit into
masterfrom
feat/iconv-receiver-ingest-1913
May 2, 2026
Merged

feat(protocol): apply FilenameConverter on receiver flist ingest (#1913)#3546
oferchen merged 1 commit into
masterfrom
feat/iconv-receiver-ingest-1913

Conversation

@oferchen
Copy link
Copy Markdown
Owner

@oferchen oferchen commented May 1, 2026

Summary

  • Document and test the receiver-side --iconv ingest path that converts
    wire-charset filenames into local-charset bytes via FilenameConverter
    before storage in FileEntry.
  • Add an explicit upstream-reference comment at the call site in
    FileListReader::read_entry_with_flist() and on apply_encoding_conversion
    itself.
  • Add three regression tests covering ISO-8859-1 -> UTF-8 conversion,
    pass-through with no converter, and identity-converter no-op.

Why

The wire-to-local conversion was wired through FileListReader::with_iconv
plus apply_encoding_conversion, but lacked an upstream-referencing call-site
comment and any direct unit test that exercises non-ASCII wire bytes through
FileListReader::read_entry. This change documents the contract and locks in
the 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 lastname intentionally retains the unconverted wire bytes so
subsequent entries share the prefix as the sender intended.

Upstream Reference

flist.c:738-754 recv_file_entry() runs the freshly-read filename through
iconvbufs(ic_recv, ...) before clean_fname().

Refs #1913.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p protocol --all-features -- -D warnings
  • cargo clippy -p protocol --all-features --tests -- -D warnings
  • CI nextest covers the new iconv_integration test module

@github-actions github-actions Bot added the enhancement New feature or request label May 1, 2026
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.
@oferchen oferchen force-pushed the feat/iconv-receiver-ingest-1913 branch from baa434c to 459616d Compare May 2, 2026 01:28
@oferchen oferchen marked this pull request as ready for review May 2, 2026 03:42
@oferchen oferchen merged commit e53b09c into master May 2, 2026
37 checks passed
@oferchen oferchen deleted the feat/iconv-receiver-ingest-1913 branch May 2, 2026 03:50
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant