Repository navigation
fix: print valid locale characters raw on the client like 3.5.2 - #8397
Merged
Merged
Conversation
A client without -8 now checks its terminal output against the locale codeset, as rsync 3.5.2 does with ic_chck (rsync.c:95-98, log.c:462-499). Printable UTF-8 names print raw; invalid bytes, C0, DEL and C1 are still escaped as \#ooo. The codeset comes from setlocale(LC_CTYPE, "") and nl_langinfo(CODESET) (main.c:1911) instead of sniffing the LANG and LC_* text. Servers, -8 and the log file keep their escaping. The EscapeStyle docs now describe the 3.5.2 filtered_fwrite, which dropped the escape_c1 argument; the matching field is removed because every escaping path already covers 0x80-0x9F.
oferchen
force-pushed
the
fix/client-output-locale-escaping
branch
from
November 17, 2026 12:15
79f2cf0 to
cb596b2
Compare
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
Under a UTF-8 locale a client printed every non-ASCII file name escaped (
caf\#303\#251) where rsync 3.5.2 printscafé.-8now checks terminal output against the locale codeset, as upstream does withic_chck(rsync.c:95-98, log.c:462-499): valid printable characters print raw; invalid bytes, C0 controls other than tab, DEL and C1 controls are escaped; a literal\#dddkeeps its guard.setlocale(LC_CTYPE, "")andnl_langinfo(CODESET)(main.c:1911), through a newplatform::locale, set before any thread starts. It replaces a guess from the text ofLANG/LC_*.-8and log files are unchanged.EscapeStyledocs and citations now describe 3.5.2'sfiltered_fwrite; the redundantescape_c1field is removed with no behaviour change.Tests
crates/cli/tests/client_output_locale_escaping.rs: seven cells compare stdout byte for byte with the rsync 3.5.2 binary (--list-only,-rv,-riunderC.UTF-8andC, plus-rv8). Before the fix the three UTF-8 cells fail; theCand-8cells pass either way and act as controls. The test fails, not skips, in CI when the oracle is missing.logging/src/escape.rs; two fail when the codeset check is forced off.Known gaps