Skip to content

fix: accept -s secluded-args in oc-rsync --server flag string - #5516

Merged
oferchen merged 2 commits into
masterfrom
fix/uts-1-secluded-args-server-mode
Jun 10, 2026
Merged

oferchen merged 2 commits into
masterfrom
fix/uts-1-secluded-args-server-mode

Conversation

@oferchen

@oferchen oferchen commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Summary

When upstream rsync invokes --server with --secluded-args / -s, the
client splits its argv: the server-options head (--server, --sender,
the packed transfer-flag string such as -slogDtpre.iLsfxCIvu, and the
value-bearing long flags) travels on the command line, while the trailing
positional args (the . separator and path arguments) stream over stdin
as NUL-delimited bytes terminated by an empty string.

The server-mode handler previously replaced its effective argument slice
with the stdin payload alone, discarding the flag string entirely. That
triggered invalid server arguments: missing rsync server flag string on
every upstream invocation with -s -- including the -ais round-trips in
testsuite/00-hello_test.py (test4, test5) under lsh.sh.

This change matches upstream's read_args() contract (io.c:1295) and
the send_protected_args() wire layout (rsync.c:283): we keep the
command-line argv tail, skip the synthetic rsync arg0 that the wire
prepends, and append the rest of the stdin payload as positional args.

Wire evidence (captured under lsh.sh -ais)

Captured via a tee wrapper around oc-rsync --server while running
rsync -ais --rsync-path=oc-rsync lh:reproA/from/ /tmp/reproA/:

  • Command-line argv: --server --sender -slogDtpre.iLsfxCIvu
  • Stdin payload: rsync\0.\0/home/ofer/reproA/from/\0\0

The flag string travels on the command line. Before this fix the server
discarded it; after this fix it is preserved and merged with the
stdin-provided positional path tail.

Test results on the Linux interop host

Before this PR:

test4
oc-rsync error: invalid server arguments: missing rsync server flag string (code 1)
rsync error: error in rsync protocol data stream (code 12)
Failed: status=12 dir-diff file-diff
FAIL    00-hello

After this PR (00-hello, tests 1-5):

test1 ... test5 -- transfer completes, ls-from and ls-to match
test6  -- still fails (--old-args, a different feature, not covered here)

Other suites that previously reported the same missing rsync server flag string error no longer surface that error:

  • exclude-lsh, files-from, alt-dest, batch-mode, hardlinks

Those suites still fail on independent issues (filter semantics,
symlink-mtime drift, --old-args re-splitting) that are tracked as
separate follow-ups.

Test plan

  • testsuite/00-hello_test.py tests 4 & 5 pass under lsh.sh -ais
    with oc-rsync --server (previously hard-failed with arg parser
    error)
  • Non-secluded --server path is unchanged (verified by running
    rsync -ai --rsync-path=oc-rsync lh:src/ dest/ end-to-end)
  • Added two round-trip regression tests in
    crates/cli/src/frontend/server/tests.rs using captured upstream
    wire bytes -- one for the packed -slogDtpre.iLsfxCIvu form and
    one for the standalone -s form
  • CI must pass: fmt+clippy, nextest (stable), Windows, macOS, Linux
    musl

upstream: rsync.c:283 send_protected_args(), io.c:1295 read_args(),
options.c:2604 server_options() (sets the s flag-string char and the
NULL split between command-line and stdin tails)

@github-actions github-actions Bot added the bug Something isn't working label Jun 9, 2026
When the upstream rsync client uses --secluded-args / -s, it splits its argv:
the server-options head (--server, --sender, packed flag string,
value-bearing long flags) travels on the command line, while the trailing
positional args (the dot separator and path arguments) stream over stdin as
NUL-delimited bytes.

The previous server-mode handler replaced its effective argument slice with
the stdin payload alone, discarding the flag string entirely. That triggered
'invalid server arguments: missing rsync server flag string' on every
upstream invocation that sets -s -- including 00-hello's test4/test5
(-ais round-trips through lsh.sh).

Match upstream's read_args() contract: keep the command-line argv tail, skip
the synthetic 'rsync' arg0 the wire prepends, and append the rest of the
stdin payload as positional arguments.

Adds two round-trip regression tests using captured upstream wire bytes:
one for the packed -slogDtpre.iLsfxCIvu form and one for the standalone -s
spelling.

upstream: rsync.c:283 send_protected_args(), io.c:1295 read_args()
@oferchen
oferchen force-pushed the fix/uts-1-secluded-args-server-mode branch from e3ac386 to 803a114 Compare June 10, 2026 02:58
@oferchen
oferchen merged commit 32e3ef7 into master Jun 10, 2026
66 of 67 checks passed
@oferchen
oferchen deleted the fix/uts-1-secluded-args-server-mode branch June 10, 2026 05:14
oferchen added a commit that referenced this pull request Jun 10, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
oferchen added a commit that referenced this pull request Jun 10, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
oferchen added a commit that referenced this pull request Jun 10, 2026
UTS-1.e (`docs/audits/uts-1-e-test6-actual-command.md`): document the
upstream `testsuite/00-hello.test` test6 command that lsh.sh forwards
to oc-rsync (`--server --sender -logDtpre.iLsfxCIvu --old-args .
'one two'`), capture the verbatim failure from
`target/interop/upstream-testsuite/00-hello.log:139-141`, and trace
the receiver-side `zero-length filename` error to a missing server-
side `--old-args` re-split (upstream `options.c:1640-1648`). Includes
two follow-up items.

UTS-1.f (`docs/audits/uts-1-f-tcpdump-wire-parity.md`): walk the
`-ais` wire-byte layout for push and pull through lsh.sh. The
symmetric oc-rsync<->oc-rsync legs (test4/test5) show PARITY, with
the drain layer matching upstream `io.c:1308-1367` byte-for-byte and
locked by PR #5610's regression test. The asymmetric upstream-client
-> oc-rsync-server legs are a GAP_FOUND because PR #5541's rebase
diff silently reverted PR #5516's cmdline+stdin merge in
`crates/cli/src/frontend/server/run.rs`. The drain test from #5610
remains valid; the merge fix needs to be reapplied. Includes three
follow-up items.

Both docs cross-reference PR #5516, PR #5610, PR #5541, the upstream
3.4.4 source at `target/interop/upstream-src/rsync-3.4.4/`, and the
captured fixture log at
`target/interop/upstream-testsuite/00-hello.log`.

No production code changes. No oc-rsync-specific feature impact. No
branding touched.
oferchen added a commit that referenced this pull request Aug 24, 2026
* fix: accept -s secluded-args in server flag string

When the upstream rsync client uses --secluded-args / -s, it splits its argv:
the server-options head (--server, --sender, packed flag string,
value-bearing long flags) travels on the command line, while the trailing
positional args (the dot separator and path arguments) stream over stdin as
NUL-delimited bytes.

The previous server-mode handler replaced its effective argument slice with
the stdin payload alone, discarding the flag string entirely. That triggered
'invalid server arguments: missing rsync server flag string' on every
upstream invocation that sets -s -- including 00-hello's test4/test5
(-ais round-trips through lsh.sh).

Match upstream's read_args() contract: keep the command-line argv tail, skip
the synthetic 'rsync' arg0 the wire prepends, and append the rest of the
stdin payload as positional arguments.

Adds two round-trip regression tests using captured upstream wire bytes:
one for the packed -slogDtpre.iLsfxCIvu form and one for the standalone -s
spelling.

upstream: rsync.c:283 send_protected_args(), io.c:1295 read_args()

* style: cargo fmt fix for assert_eq! collapsing
oferchen added a commit that referenced this pull request Aug 24, 2026
Group PRs #5510, #5516, #5519, #5520, #5523, #5525-#5544 by shared root
cause rather than by Stream bucket. Seven clusters surface; the parser-
stores-string and field-vs-method shadowing clusters cover the largest
share of the series, and the receiver-driver wiring-parity gap explains
the NDX_DEL_STATS goodbye misses in both #5536 and #5542. Includes a
defense-in-depth audit mapping each cluster onto the rust-landlock
ruleset wired at crates/fast_io/src/landlock.rs.

Doc-only; no code paths touched.
oferchen added a commit that referenced this pull request Aug 24, 2026
UTS-1.e (`docs/audits/uts-1-e-test6-actual-command.md`): document the
upstream `testsuite/00-hello.test` test6 command that lsh.sh forwards
to oc-rsync (`--server --sender -logDtpre.iLsfxCIvu --old-args .
'one two'`), capture the verbatim failure from
`target/interop/upstream-testsuite/00-hello.log:139-141`, and trace
the receiver-side `zero-length filename` error to a missing server-
side `--old-args` re-split (upstream `options.c:1640-1648`). Includes
two follow-up items.

UTS-1.f (`docs/audits/uts-1-f-tcpdump-wire-parity.md`): walk the
`-ais` wire-byte layout for push and pull through lsh.sh. The
symmetric oc-rsync<->oc-rsync legs (test4/test5) show PARITY, with
the drain layer matching upstream `io.c:1308-1367` byte-for-byte and
locked by PR #5610's regression test. The asymmetric upstream-client
-> oc-rsync-server legs are a GAP_FOUND because PR #5541's rebase
diff silently reverted PR #5516's cmdline+stdin merge in
`crates/cli/src/frontend/server/run.rs`. The drain test from #5610
remains valid; the merge fix needs to be reapplied. Includes three
follow-up items.

Both docs cross-reference PR #5516, PR #5610, PR #5541, the upstream
3.4.4 source at `target/interop/upstream-src/rsync-3.4.4/`, and the
captured fixture log at
`target/interop/upstream-testsuite/00-hello.log`.

No production code changes. No oc-rsync-specific feature impact. No
branding touched.
oferchen added a commit that referenced this pull request Aug 24, 2026
When the upstream rsync client uses --secluded-args / -s, it splits its
argv: the server-options head (--server, --sender, packed flag string,
value-bearing long flags) travels on the command line, while the trailing
positional args (the dot separator and path arguments) stream over stdin
as NUL-delimited bytes. PR #5516 wired the merge into run_server_mode so
both sources combine into the effective argv before flag parsing. PR #5541
(URV-6.b NDX_DEL_STATS wiring) inadvertently reverted that merge along
with the regression tests, restoring the prior behaviour of replacing
effective_args with the stdin payload alone.

The regression discards the cmdline tail. Against an upstream client that
sets -s, the server loses the packed flag string entirely and aborts with
"invalid server arguments: missing rsync server flag string". The
00-hello suite kept passing because test4/test5 run oc-rsync on both ends
and the symmetric client buries the full arg list inside the stdin
payload.

Restore the merge contract from PR #5516: skip the synthetic "rsync" arg0
the wire prepends and prepend args[1..] (the command-line tail) before
the remaining stdin args. Re-add the two PR #5516 regression tests
covering both the packed -slogDtpre.iLsfxCIvu form and the standalone -s
spelling.

upstream: main.c::read_args() merges cmdline args with stdin args under
--protect-args / secluded-args (main.c:1852 callsite, io.c:1308
read_args(), rsync.c:283 send_protected_args(), options.c:2745 NULL
split). Documented in the UTS-1.e+.f audit (#5631).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant