Repository navigation
Remove redundant must_use annotations on protocol parsers - #33
Merged
Merged
Conversation
oferchen
added a commit
that referenced
this pull request
Aug 15, 2026
…#7357) Upstream has exactly one writer to the log file: `logit()` (log.c:126), which hands every line to `filtered_fwrite(logfile_fp, buf, len, 0, 1, trailing)` at log.c:132. Escaping in the sink is what makes it unbypassable - a producer cannot forget it, because there is no other way to reach the file. oc-rsync escaped in the CLI out-format renderer instead. That covered `--log-file` on the client and nothing else: the daemon writes its log through an entirely different path, so a peer-supplied operand reached the log with a raw ESC where rsync 3.5.0 writes `\#33`. Move the escaper down to `logging_sink::logfile::LogFileWriter`, the one type both the CLI (summary.rs) and the daemon (daemon.rs, privilege.rs, hardening.rs, module_access) construct for a log file, and switch the renderer to the new `EscapeStyle::passthrough`. Applying both would double-escape: the sink's `\#ddd` guard (log.c:252-254) fires on the renderer's own output and turns `\#33` into `\#134#033`. Two consequences fall out of putting it in the sink: - `EscapeStyle` gains an `escape_controls` switch. Upstream has no such switch because every `filtered_fwrite` call site escapes C0 controls; oc-rsync needs one because it now has a sink upstream does not - the passthrough style, whose whole job is to leave the bytes alone. - The `Write` adapter now treats a newline as a record terminator only when it ends the write. A newline *inside* the message is escaped as `\#12`, matching log.c:128-129, which strips exactly one trailing newline. This is the injection itself: every line the sink emits gets a real timestamp and pid, so a name carrying `\n` would otherwise produce a second, entirely authentic-looking record. Tests: a daemon integration test pins the half a renderer-side escaper cannot reach (peer-supplied operand in the `client args:` line), with a printable control operand so the assertions cannot pass vacuously. It fails with a raw ESC in the log when the sink escaping is reverted. The existing 3.5.0 oracle test for `--log-file` still passes unchanged, which is what proves the move did not perturb the client half.
oferchen
added a commit
that referenced
this pull request
Aug 24, 2026
…#7357) Upstream has exactly one writer to the log file: `logit()` (log.c:126), which hands every line to `filtered_fwrite(logfile_fp, buf, len, 0, 1, trailing)` at log.c:132. Escaping in the sink is what makes it unbypassable - a producer cannot forget it, because there is no other way to reach the file. oc-rsync escaped in the CLI out-format renderer instead. That covered `--log-file` on the client and nothing else: the daemon writes its log through an entirely different path, so a peer-supplied operand reached the log with a raw ESC where rsync 3.5.0 writes `\#33`. Move the escaper down to `logging_sink::logfile::LogFileWriter`, the one type both the CLI (summary.rs) and the daemon (daemon.rs, privilege.rs, hardening.rs, module_access) construct for a log file, and switch the renderer to the new `EscapeStyle::passthrough`. Applying both would double-escape: the sink's `\#ddd` guard (log.c:252-254) fires on the renderer's own output and turns `\#33` into `\#134#033`. Two consequences fall out of putting it in the sink: - `EscapeStyle` gains an `escape_controls` switch. Upstream has no such switch because every `filtered_fwrite` call site escapes C0 controls; oc-rsync needs one because it now has a sink upstream does not - the passthrough style, whose whole job is to leave the bytes alone. - The `Write` adapter now treats a newline as a record terminator only when it ends the write. A newline *inside* the message is escaped as `\#12`, matching log.c:128-129, which strips exactly one trailing newline. This is the injection itself: every line the sink emits gets a real timestamp and pid, so a name carrying `\n` would otherwise produce a second, entirely authentic-looking record. Tests: a daemon integration test pins the half a renderer-side escaper cannot reach (peer-supplied operand in the `client args:` line), with a printable control operand so the assertions cannot pass vacuously. It fails with a raw ESC in the log when the sink escaping is reverted. The existing 3.5.0 oracle test for `--log-file` still passes unchanged, which is what proves the move did not perturb the client half.
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
#[must_use]annotations from Result-returning legacy negotiation helpers to keep clippy cleanResultTesting