Skip to content

fix: complete chmod spec parser parity with upstream - #5534

Merged
oferchen merged 2 commits into
masterfrom
fix/uts-17-chmod-spec-parse
Jun 10, 2026
Merged

oferchen merged 2 commits into
masterfrom
fix/uts-17-chmod-spec-parse

Conversation

@oferchen

Copy link
Copy Markdown
Owner

Summary

Upstream testsuite chmod-option.test exercises both the CLI --chmod=SPEC parser and the daemon's incoming chmod = SPEC / outgoing chmod = SPEC module directives. The CLI side already routes --chmod through ChmodModifiers into the receiver's MetadataOptions, but the daemon side parsed the directive into ModuleDefinition and then dropped it on the floor: the spec never reached the transfer engine, so the test's incoming chmod = Fo-x case was a silent no-op.

  • Add chmod_modifiers: Option<ChmodModifiers> to ServerConfig / ServerConfigBuilder.
  • Daemon build_server_config() resolves module.incoming_chmod() (push) or module.outgoing_chmod() (pull) into the parsed modifier chain. A malformed spec is logged and skipped, matching upstream's parse_chmod() NULL return.
  • Receiver setup_transfer forwards the daemon-sourced modifiers via MetadataOptions::with_chmod, so they apply at the same set_file_attrs() site as a client-side --chmod.

Also adds upstream-corpus parser tests for F600, D755, Fu=rw,go-rwx, Dg+s, +X, Fo-x, ug-s,a+rX,D+w, and u= so any drift from chmod.c::parse_chmod() surfaces here instead of in interop.

Test plan

  • CI fmt + clippy
  • CI nextest (stable) Linux / macOS / Windows / musl
  • CI interop validation (chmod-option, daemon push, --no-perms)

@github-actions github-actions Bot added the bug Something isn't working label Jun 10, 2026
oferchen added 2 commits June 10, 2026 14:03
Daemon module directives `incoming chmod = SPEC` and `outgoing chmod =
SPEC` were parsed off the wire and stored on `ModuleDefinition`, but
never made it to the transfer engine. The receiver built
`MetadataOptions` directly from the client-supplied flags, so any
daemon-side chmod policy was a silent no-op.

Thread a `chmod_modifiers: Option<ChmodModifiers>` field through
`ServerConfig` / `ServerConfigBuilder`. The daemon's
`build_server_config()` now resolves the module's `incoming_chmod()`
(client push) or `outgoing_chmod()` (client pull) into the parsed
modifier chain and seeds it on the config; the receiver's
`setup_transfer` forwards it into `MetadataOptions::with_chmod`. A
malformed spec is logged at warn level and ignored, matching upstream's
`parse_chmod()` returning NULL.

Also lock in upstream chmod-option.test parser parity with explicit
clause-level tests for `F600`, `D755`, `Fu=rw,go-rwx`, `Dg+s`, `+X`,
`Fo-x`, `ug-s,a+rX,D+w`, and `u=` so any drift from
`chmod.c::parse_chmod()` surfaces here rather than in interop.

# Conflicts:
#	crates/daemon/src/daemon/sections/module_access/client_args.rs
#	crates/transfer/src/config/builder.rs
#	crates/transfer/src/config/builder_tests.rs
#	crates/transfer/src/config/mod.rs
#	crates/transfer/src/receiver/transfer/setup.rs
@oferchen
oferchen force-pushed the fix/uts-17-chmod-spec-parse branch from 1c1eee2 to 60a85e9 Compare June 10, 2026 11:07
@oferchen
oferchen merged commit 0e3dad0 into master Jun 10, 2026
2 of 8 checks passed
@oferchen
oferchen deleted the fix/uts-17-chmod-spec-parse branch June 10, 2026 11:13
oferchen added a commit that referenced this pull request Aug 24, 2026
Daemon module directives `incoming chmod = SPEC` and `outgoing chmod =
SPEC` were parsed off the wire and stored on `ModuleDefinition`, but
never made it to the transfer engine. The receiver built
`MetadataOptions` directly from the client-supplied flags, so any
daemon-side chmod policy was a silent no-op.

Thread a `chmod_modifiers: Option<ChmodModifiers>` field through
`ServerConfig` / `ServerConfigBuilder`. The daemon's
`build_server_config()` now resolves the module's `incoming_chmod()`
(client push) or `outgoing_chmod()` (client pull) into the parsed
modifier chain and seeds it on the config; the receiver's
`setup_transfer` forwards it into `MetadataOptions::with_chmod`. A
malformed spec is logged at warn level and ignored, matching upstream's
`parse_chmod()` returning NULL.

Also lock in upstream chmod-option.test parser parity with explicit
clause-level tests for `F600`, `D755`, `Fu=rw,go-rwx`, `Dg+s`, `+X`,
`Fo-x`, `ug-s,a+rX,D+w`, and `u=` so any drift from
`chmod.c::parse_chmod()` surfaces here rather than in interop.

# Conflicts:
#	crates/daemon/src/daemon/sections/module_access/client_args.rs
#	crates/transfer/src/config/builder.rs
#	crates/transfer/src/config/builder_tests.rs
#	crates/transfer/src/config/mod.rs
#	crates/transfer/src/receiver/transfer/setup.rs
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