Repository navigation
Conversation
oferchen
force-pushed
the
fix/server-remote-option-hang
branch
from
November 10, 2026 14:33
17e14dd to
b2295f5
Compare
oferchen
force-pushed
the
fix/server-remote-option-hang
branch
2 times, most recently
from
November 10, 2026 19:06
d5a8a8f to
6918635
Compare
oferchen
force-pushed
the
fix/server-remote-option-hang
branch
5 times, most recently
from
November 11, 2026 10:32
e2cd45d to
1819b44
Compare
oferchen
force-pushed
the
fix/server-remote-option-hang
branch
from
November 11, 2026 10:49
1819b44 to
eabfba3
Compare
oferchen
force-pushed
the
fix/server-remote-option-hang
branch
from
November 11, 2026 10:55
eabfba3 to
571068d
Compare
Owner
Author
|
Merge train: this pull request failed its batch run on its own (https://github.com/oferchen/rsync/actions/runs/43029669131). Failed required checks: upstream-testsuite / upstream testsuite, . It is held out of batches until its head changes. |
oferchen
added a commit
that referenced
this pull request
Nov 11, 2026
) ## Summary Collapses the daemon's module filter parser into the one core filter parser, so module directives, client options and server argv options all go through a port of 3.5.1's `parse_filter_str` (exclude.c:1516-1598) and `add_rule` (exclude.c:279-314). Stacked on #8343. - **One parser.** `crates/core/src/client/filter_args/filter_str.rs` carries the rule template and xflags (`OLD_PREFIXES`, `ABS_IF_SLASH`, `DIR2WILD3`). `add_rule` does the side drop, the slash anchoring (a trailing slash does not count, leading `**` stays unanchored) and the `/***` suffix on Exclude and Protect rules only. `--include`, `--exclude` and `--filter` use it, and so do the module directives. - **Module directives** (`clientserver.c:933-952`): `filter` is word-split with the full grammar; `include`/`exclude` are word-split with `OLD_PREFIXES`; `include from`/`exclude from` read with `OLD_PREFIXES` and `FATAL_ERRORS`. About 1,700 lines of the daemon's own parser in `module_access/helpers.rs` are deleted. The old parser ignored `!` and anchored `/`, so a module served files that 3.5.1 hides. - **A clear empties the whole list.** `pop_filter_list(listp); listp->head = NULL` (exclude.c:1540-1546) drops every rule ahead of the clear, argv rules included. oc used to clear only the file's own rules. This was MEASURED on 3.5.1: with `-f '- b' -f '. rules'` and `!` in `rules`, both a and b transfer. - **Refusal (E1).** A refused module directive ends the session before `@RSYNCD: OK`, and the cause goes to the daemon log only, as 3.5.1 does. oc used to send an `@ERROR` line it made up itself. - **Merge-file opens** are gated by `check_filter(&daemon_filter_list)` while the list is being built (exclude.c:1639-1664). An absolute name skips `module_dirlen` by length alone. A name with no slash opens from cwd (`parse_merge_name`, exclude.c:704-715). - **Error text.** - A rule read from a file is reported as `<rule from FILE line N>`. - A word-split file rule is reported as `<rule from FILE>` (exclude.c:71-136, MEASURED). - `-from` records now carry their line number. - **Wire fixes.** - A `:p` dir-merge rule now sends `p` on the wire (`get_rule_prefix`, exclude.c:1872). - A `:r` dir-merge rule keeps its side. - The receiver's daemon filter set honours `directory_only`, `anchored` and `negate`. - Corrected the `pop_filter_list` comment in merge.rs, which described the clear wrongly. ## Tests - New `tests/daemon_module_filters.rs`: 7 cells against live 3.5.1. - negate and abs-path modifiers - both-sides versus sender-only rules - a trailing slash does not anchor - old-prefix word split - a clear inside a merge file - a self-excluding merge gates its own open - a refused directive is logged and sends nothing - New cell `a_clear_inside_a_file_empties_the_rules_ahead_of_it` in `crates/cli/tests/upstream_compat_filter_rule_parse.rs`. - New `crates/core/src/client/filter_args/tests/filter_str.rs`: the `add_rule` cells, plus the 17 split cells moved from the daemon. ### Dropped or replaced daemon tests The parser these tests exercised is deleted: - `strip_matched_keyword_*` (7): the helper is gone. The keyword walk is covered by the core `split_*` cells. - `build_pattern_rule_{exclude,include,anchored,doublestar_prefix_stays_unanchored,directory_only_exclude_dir2wild3,directory_only_include_preserved}`, `pattern_{leading_slash_is_anchored,no_slash_is_not_anchored,embedded_slash_is_anchored,deep_path_is_anchored}`, `directory_exclude_gets_wild3`, `directory_include_keeps_directory_flag`, `include_with_embedded_slash_is_anchored` (13): duplicates of the core `add_rule` cells (`a_pattern_without_a_slash_is_added_as_written`, `a_slash_anywhere_in_the_pattern_anchors_it`, `a_leading_double_star_stays_unanchored`, `a_trailing_slash_marks_a_directory_rule_and_is_not_counted`). - `an_inexpressible_modifier_drops_the_rule_rather_than_refusing_it`: replaced by `the_negate_and_xattr_modifiers_are_carried_on_the_rule`. The rule is now carried, not dropped. - `read_patterns_from_file_reads_a_plain_file_unchanged`: a duplicate of `exclude_from_reads_one_pattern_per_line`. - The other `read_patterns_from_file_*` and `split_filter_tokens_*` tests were renamed to `exclude_from_*` and moved to core `split_*`, unchanged. - Updated tests: - `build_daemon_filter_rules_line_final_clear_*` now expects an empty list. - `*_non_merge_cvs_*` now expects the `-C` defaults expanded. - Three cli tests were renamed to `*_clears_*`. ## Residuals - **E2 (task 547).** These three rows of the 3.5.1 differential table still disagree: `:w .ws` on rsh, on daemon `-M` and on a module directive. All three are the sender-side per-dir merge error report: 3.5.1's client prints the parse error first and exits 1. The 4 Push cells in `upstream_compat_filter_rule_parse` (`c_modifier_inside_a_per_directory_merge_file`, `merge_file_rules_end_where_upstream_ends_them`, `naming_both_sides_still_names_a_side`, `sided_merge_file_refuses_a_sided_rule`) fail for the same reason. They also fail on master's binary under `OC_RSYNC_UPSTREAM_COMPAT=1` and SKIP in CI. Task 547 fixes them in a PR stacked on this one. - The missing filter-file texts `failed to read filter file '...'` and `failed to read filter patterns from standard input` are not 3.5.1's. This PR moved them unchanged from cli to core, and they are left for the task 632 and 626 sweep. ## Gates - `cargo fmt --check` and `check_rustfmt_all.py` - workspace clippy `-D warnings` - windows-gnu clippy (cli, daemon, transfer, core) - no-default clippy (cli, transfer, daemon, core) - dead-code census: one stale allowlist row (`with_dir_merge_options`) removed - citation ratchet: OK; cli baseline lowered from 1 to 0 - targeted nextest: 1839 run, 1835 pass. The 4 failures are the task 547 Push cells listed above.
Owner
Author
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
When an oc server's own argv carries a remote option, it now ignores it as 3.5.1 does. Before this change the server hung, and so did the client. This happens with
--rsync-path="oc-rsync -M--fake-super", for example.Root cause
Measured with strace on the server:
detect_secluded_args_flagtreated anysin a single-dash token as-s. Thesinside-M--fake-supertherefore turned on secluded-args mode.recv_secluded_argsthen read the client's protocol version (!\0\0) as an argument list.A stray
-son the server argv reaches the same hang by a second route. 3.5.1 exits 1 there:read_args()replaces argv, and with no operands left it hitsusage(FERROR); exit_cleanup(RERR_SYNTAX)(main.c:1956-1969).A mismatch in the
-ecapability letters alone does not hang either implementation. A 3.5.1 client pushing to either server with the letters stripped (-r) or empty (-re.) completes the transfer.Changes
fix: ignore -M on the server argv and refuse an empty secluded liststrip_remote_optionsremoves-M<v>,-M <v>,--remote-option=<v>and--remote-option <v>before any server scanner sees the argv. A server only records these (options.c:1762-1777); only a local copy's forked server re-parses them (pipe.c:143-150).Remote option must start with a dash: <v>and exit 1 (options.c:1764-1767).fix: read the secluded-args flag from a short-option cluster like poptdetect_secluded_args_flagnow scans a short-option cluster the way popt does. It reads letters up to the first option that takes a value:@ B M T e f, the only short options withPOPT_ARG_STRING/POPT_ARG_INTin options.c long_options.-fs,-T/tmp/s,-B1sand-rM--fake-superno longer turn on secluded args.ecovers what the old split at.was guarding against: thesamong the capability letters.Evidence
tests/server_remote_option_argv.rs.run_deadlinedwith a 30 s budget, so a hang fails as a namedTIMEOUT.-Mspellings transfer, and the value never takes effect: nouser.rsync.*stash appears on the destination.-Mfoois refused with the dash message and transfers nothing.-sfails withsyntax or usage error (code 1).-M--fake-superand--remote-option=--fake-super: both servers exit 0 and transfer.-s: both exit 12 at the client, and the server reportssyntax or usage error (code 1).-Mfoo: both exit 12 at the client, withRemote option must start with a dash: foo.detect_secluded_args_ignores_s_in_an_option_value.-stest fails asTIMEOUT ... after 30s.-Mfootest fails.Whole-argv parse (task 291, third commit)
fix: parse the whole server argv like 3.5.1 popt passnormalize_server_argvreplacesstrip_remote_options. It reads every token before--the way 3.5.1's single popt pass does (options.c:1497), so a short option counts wherever it sits, before--serverincluded.@ B M T e f). Every letter joins one flag string placed right after--server, with the last-evalue kept.-B,-@and-Tbecome the-B<n>,-@<n>and--temp-dir=forms the long-option pass already reads.-Mand--remote-optionare still dropped, with the dash check above.-fis consumed at one marked point and not applied yet; server-argv filters are a follow-up.--serverrestarts the popt pass from argv[1] (options.c:1517-1524), so an option ahead of it is parsed twice. A-vthere counts as-vv, and both servers then printdelta-transmission enabled.<prog>: <opt>: unknown option, then the RERR_SYNTAX trailer (options.c:915, main.c:1909-1912). Theon remote machine:prefix (options.c:2051-2054) and the[server=...]role apply only once--serverhas been parsed, because that option sets am_server (options.c:889). Ahead of it, the line has no prefix and the role is[client=...].Evidence for this commit:
tests/server_argv_popt_parity.rs. Every push is driven by the 3.5.1 client under a 30 s deadline that fails asTIMEOUT.-vahead of--server: the 3.5.1 and oc servers both exit 0, transfer the file, and printdelta-transmission enabled.-jbefore--server,-vjafter it,--bogusbefore and--bogusafter: oc's exit code and refusal lines (text and role) equal 3.5.1's in each case, and nothing is transferred.--server, value options taking the rest of the token or the next one, identity on an upstream argv, refusal text and side, and operands after--left alone.--server: the-vcell fails.--serverleft unmerged: 4 cells fail, including two inserver_remote_option_argv.rs.The two gaps this PR listed as task 291 are closed: a stray option before the flag string is honoured, and
-rM--xmerges into the flag string as-r. A refused-Mvalue ahead of--servernow prints the cause and a[client=...]trailer on two lines, as 3.5.1 does.Server-argv filters (task 617, commits 4-6)
Filter options on a server's own argv now work as they do in 3.5.1.
-f,-F,--filter,--exclude,--include,--exclude-fromand--include-fromfrom its argv, ahead of the rules the client sends on the filter list. Before this change it ignored-fand refused the long forms as unknown options (rc 12).-M-forwarded filter options through the same argv pass. A filter inside a short cluster (-M-rf- x) was previously missed.What 3.5.1 does:
parse_arguments()adds argv filters tofilter_list, in argv order (options.c:1620-1656).-Fadds: /.rsync-filter, then- .rsync-filter(options.c:1718-1727).recv_filter_list()then appends the wire rules (exclude.c:1971-1986).sanitize_paths(clientserver.c:1068).--serverrestarts the popt pass (options.c:1517-1524) without clearingfilter_listorF_option_cnt. A filter option ahead of--servertherefore applies twice, so one-Fthere counts as-FF.rsyserr()asrsync: [server] failed to open exclude file X: ... (2), followed by the RERR_FILEIO trailer (exclude.c:1714-1719). A malformed rule prints filter_rule_err()'s bare line, followed by the RERR_SYNTAX trailer (exclude.c:132-136).refactor: split the argv filter rule builder out of apply_filtersbuild_filter_rulesis the client's argv rule loop with noClientConfigBuilderin its signature.apply_filterswraps it, so client behaviour is unchanged; the existing cli filter tests pass untouched.fix: honour filter options on a remote-shell server argv like 3.5.1normalize_server_argvturns every filter option into a joined--opt=VALUEtoken behind the flag string, in argv order:-fand the split--exclude VALUEforms are joined to their values.-Fis expanded to its rule.--serverare kept twice.server/argv_filters.rsturns those tokens into the client'sFilterOrderTokens. It builds the rules withbuild_filter_rulesand converts them with the client'sbuild_wire_format_rules, whichcorenow exports. The result goes into the existingServerConfig::argv_filter_rules, which already ranks those rules ahead of the received list.[server=...]trailer and exits with upstream's code.fix: read daemon -M filter options through the shared argv passnormalize_server_argvand its helpers move from the cli server intotransfer::server_argv(core::server::server_argv), so the daemon can call it. The cli re-exports them, and the unit tests move with them.-f/-Ftoken arms are gone, now that every filter option arrives joined. The module-confined reader, the daemon-rule gating and the refusals are unchanged; the existingdaemon_m_forwarded_filterstests pass untouched.Evidence for these commits:
tests/server_argv_filters.rs. Each cell asserts 3.5.1's own outcome first, so a cell cannot pass vacuously, then checks that oc matches it. The 3.5.1 client drives every transfer under a 30 s deadline, so a hang fails as a namedTIMEOUT.--exclude=b,--exclude b(both after--server) and-f '- b'(before it):d/bis dropped.-Fafter--server: the per-directory.rsync-filter(- a) applies. With-Fbefore--server, it also hides.rsync-filteritself.--exclude-from=nope: exit 12 at the client. The server lines match:rsync: [server] failed to open exclude file nope: No such file or directory (2)and theerror in file IO (code 11)trailer.--deletepush with-f 'P keep':keepsurvives, as on 3.5.1.--deletepush with-M-rf- x, compared against a 3.5.1 daemon:xsurvives.transfer::server_argv: filter options joined in argv order, doubled ahead of--server, a third-Fadding nothing, and the rewrite applied a second time leaving the argv unchanged.--server: the-Fcell fails.-Fnot expanded: the-Fcell fails.--exclude-fromcell fails.--exclude VALUEnot joined: the pull cell fails.Not in scope
-vvand above, the two servers print different debug lines (3.5.1 prints protocol and server_recv lines, oc prints others). That is server debug-line parity, not argv parsing.--delete-excludedgiven on the server argv does not mark argv rules sender-side the way exclude.c:1478-1481 does for rules parsed after it. The server builds its argv rules as though--delete-excludedwere absent.parse_arguments()does is a separate question.-f '. nope') is reported with its absolute path where 3.5.1 prints the name as given. The oc client does the same today; the server inherits it from the shared builder.