feat: server-side tolerance for unknown --info tokens (upstream parity)#4055
Merged
oferchen merged 6 commits intoMay 14, 2026
Merged
Conversation
Mirror upstream's parse_output_words() guard so the server side silently skips unknown info-flag names. A newer client can forward info tokens this build has not learned yet without breaking the transfer, while the client-side parser still rejects unknown tokens so typos surface at the source. upstream: options.c parse_output_words - the `!am_server` check at options.c:465 short-circuits the `Unknown --info item` exit. Refs #2168
The apply() helper is only invoked from unit tests now that production code routes through apply_with_mode(). Clippy's dead-code lint flagged it under -D warnings. Gating it with #[cfg(test)] keeps tests compiling while satisfying the lib build.
clippy::err_expect lint became active after deriving Debug on InfoFlagSettings; the lint requires the success type to implement Debug to suggest the simpler expect_err form.
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…y) (#4055) * feat: server-side tolerance for unknown --info tokens Mirror upstream's parse_output_words() guard so the server side silently skips unknown info-flag names. A newer client can forward info tokens this build has not learned yet without breaking the transfer, while the client-side parser still rejects unknown tokens so typos surface at the source. upstream: options.c parse_output_words - the `!am_server` check at options.c:465 short-circuits the `Unknown --info item` exit. Refs #2168 * fix: gate unused apply() wrapper behind cfg(test) The apply() helper is only invoked from unit tests now that production code routes through apply_with_mode(). Clippy's dead-code lint flagged it under -D warnings. Gating it with #[cfg(test)] keeps tests compiling while satisfying the lib build. * fix: derive Debug on InfoFlagSettings for expect_err in tests * fix: replace err().expect() with expect_err() in test sites clippy::err_expect lint became active after deriving Debug on InfoFlagSettings; the lint requires the success type to implement Debug to suggest the simpler expect_err form. * fix: derive Debug on DebugFlagSettings for expect_err in tests * fix: convert remaining multi-line err().expect() to expect_err()
oferchen
added a commit
that referenced
this pull request
May 18, 2026
…y) (#4055) * feat: server-side tolerance for unknown --info tokens Mirror upstream's parse_output_words() guard so the server side silently skips unknown info-flag names. A newer client can forward info tokens this build has not learned yet without breaking the transfer, while the client-side parser still rejects unknown tokens so typos surface at the source. upstream: options.c parse_output_words - the `!am_server` check at options.c:465 short-circuits the `Unknown --info item` exit. Refs #2168 * fix: gate unused apply() wrapper behind cfg(test) The apply() helper is only invoked from unit tests now that production code routes through apply_with_mode(). Clippy's dead-code lint flagged it under -D warnings. Gating it with #[cfg(test)] keeps tests compiling while satisfying the lib build. * fix: derive Debug on InfoFlagSettings for expect_err in tests * fix: replace err().expect() with expect_err() in test sites clippy::err_expect lint became active after deriving Debug on InfoFlagSettings; the lint requires the success type to implement Debug to suggest the simpler expect_err form. * fix: derive Debug on DebugFlagSettings for expect_err in tests * fix: convert remaining multi-line err().expect() to expect_err()
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
Make oc-rsync's
--info=parser tolerate unknown tokens when running on the server side, matching upstream rsync'sparse_output_words()(options.c:465). The client-side parser keeps erroring on unknown tokens so typos still surface at the source.This preserves cross-version compatibility: a newer client can forward info names this build has not learned yet without breaking the transfer.
Upstream reference
The
!am_serverclause is the entire mechanism: known tokens still apply on either side, but theUnknown ...exit only fires on the client.Changes
parse_info_flags_server()is a new entry point that calls the shared parser witham_server=true;InfoFlagSettings::apply_with_mode()skips the unknown-token error in that mode while still rejecting malformed inputs (empty tokens, out-of-range levels for known names).--info=FLAGS, captures the raw values, and validates them viaparse_info_flags_server. Before this change the argument leaked into the positional path list becauseis_known_server_long_flagdid not know about it.Test plan
parse_info_flags_client_rejects_unknown_token- client mode still errors withUnknown --info item ...parse_info_flags_server_accepts_unknown_token- server mode silently accepts an unknown tokenparse_info_flags_server_mixes_known_and_unknown- known tokens still apply in server mode when unknown ones are interleavedlong_flags_info_is_captured- server-mode argument parser captures--info=FLAGSinstead of dropping it into positional argsRefs #2168