Skip to content

docs(audits): confirm filter rules already match upstream iconv policy (#1914)#3550

Merged
oferchen merged 1 commit into
masterfrom
feat/iconv-filter-rules-1914
May 2, 2026
Merged

docs(audits): confirm filter rules already match upstream iconv policy (#1914)#3550
oferchen merged 1 commit into
masterfrom
feat/iconv-filter-rules-1914

Conversation

@oferchen
Copy link
Copy Markdown
Owner

@oferchen oferchen commented May 2, 2026

Summary

  • Audit confirms oc-rsync's filter-rule evaluation already matches upstream rsync 3.4.1 with --iconv. No code change is required.
  • Upstream exclude.c contains zero iconv references. Filter rules match local-charset bytes; iconv conversion happens at the flist boundary only (sender filters before iconvbufs(ic_send, ...); receiver filters after iconvbufs(ic_recv, ...)).
  • oc-rsync mirrors this: FilterChain::allows() in the sender walker sees raw filesystem Path bytes, and FilterChain::allows_deletion() on the receiver sees post-ic_recv local-charset names from the file list and read_dir entries. Pattern strings flow CLI -> filters crate without an iconv hop.

Audit finding

Wiring a FilenameConverter into the filter chain would be incorrect: it would double-convert names on the receiver and convert patterns away from the user's local charset, breaking pattern matches for any non-ASCII pattern.

The new docs/audits/iconv-filter-rules.md documents the exact upstream call sites, their oc-rsync counterparts, and the pattern-string handling, so the decision is reviewable and traceable.

Test plan

  • cargo fmt --all -- --check (no Rust code changed; docs-only commit)
  • CI: docs change goes through standard workflows
  • Existing iconv pipeline tests cover the wire conversion direction (docs/audits/iconv-pipeline.md)
  • Existing filter-chain tests cover pattern evaluation against local-charset paths

#1914)

Audit the filter-evaluation entry points to confirm they operate on
local-charset names, matching upstream rsync 3.4.1 exactly.

Upstream rsync's exclude.c contains zero iconv references. Filter rules
match raw bytes in the local charset on both sender and receiver. The
hand-off happens at the flist boundary: sender filters before
iconvbufs(ic_send,...), receiver filters after iconvbufs(ic_recv,...).
Pattern strings are stored verbatim from CLI/merge-files in the local
charset.

oc-rsync follows the same model:
- Sender FilterChain::allows() in generator/file_list/walk.rs sees raw
  Path bytes from the local filesystem before encoding conversion.
- Receiver FilterChain::allows_deletion() in receiver/directory/deletion.rs
  sees post-ic_recv local-charset names from the file list and entry
  names from read_dir().
- Pattern strings flow through CLI -> filters crate without iconv hops.

No code change required. Wiring a FilenameConverter into the filter
chain would double-convert names and break pattern matches for non-ASCII
patterns.
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label May 2, 2026
@oferchen oferchen merged commit 82db084 into master May 2, 2026
8 checks passed
@oferchen oferchen deleted the feat/iconv-filter-rules-1914 branch May 2, 2026 13:01
oferchen added a commit that referenced this pull request May 5, 2026
#1914) (#3550)

Audit the filter-evaluation entry points to confirm they operate on
local-charset names, matching upstream rsync 3.4.1 exactly.

Upstream rsync's exclude.c contains zero iconv references. Filter rules
match raw bytes in the local charset on both sender and receiver. The
hand-off happens at the flist boundary: sender filters before
iconvbufs(ic_send,...), receiver filters after iconvbufs(ic_recv,...).
Pattern strings are stored verbatim from CLI/merge-files in the local
charset.

oc-rsync follows the same model:
- Sender FilterChain::allows() in generator/file_list/walk.rs sees raw
  Path bytes from the local filesystem before encoding conversion.
- Receiver FilterChain::allows_deletion() in receiver/directory/deletion.rs
  sees post-ic_recv local-charset names from the file list and entry
  names from read_dir().
- Pattern strings flow through CLI -> filters crate without iconv hops.

No code change required. Wiring a FilenameConverter into the filter
chain would double-convert names and break pattern matches for non-ASCII
patterns.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant