Skip to content

fix: create the --delay-updates/--partial-dir staging dir 0700 - #8305

Closed
oferchen wants to merge 2 commits into
masterfrom
fix/staging-dir-mode-0700
Closed

oferchen wants to merge 2 commits into
masterfrom
fix/staging-dir-mode-0700

Conversation

@oferchen

@oferchen oferchen commented Nov 3, 2026

Copy link
Copy Markdown
Owner

Summary

upstream util1.c:1625 handle_partial_dir(..., PDIR_CREATE) creates the staging directory with do_mkdir_at(dir, 0700), and reuses an existing directory without a chmod (:1616-1624). The network receiver's disk-commit path (disk_commit/process/commit.rs) created it through create_dir_all_sandboxed(.., 0o777). Under umask 022 that gave 755 on push and pull, where 3.5.1 gives 700. The local engine and the abort-time partial keep were already 0700.

create_dir_all_sandboxed now takes the mode. The staging dir passes 0o700. The --backup-dir parents keep 0o777, matching upstream ACCESSPERMS (backup.c:128, util1.c:241).

Oracle (rsync 3.5.1 tarball build, umask 022, interrupted -r transfer, stat of the staging dir)

options leg 3.5.1 before after
--partial-dir=.pd local / pull 700 700 700
--delay-updates --partial local 700 700 700
--delay-updates --partial push / pull 700 755 700

Tests

disk_commit::tests::staging_dir_mode (unix):

  • delay_updates_creates_the_partial_dir_0700: a new staging dir is 0700.
  • delay_updates_keeps_an_existing_partial_dir_mode: an existing 0751 dir stays 0751, as upstream skips the mkdir and never chmods.

Each mutation is killed by exactly one test:

  • Creating with 0o777 fails the first test only.
  • Creating, then chmodding 0700 fails the second test only.

Gates: rustfmt-all passes. Workspace clippy with -D warnings is clean. Running nextest on package(transfer) & (delay_updates | partial_dir | backup) gives 163/163 passed.

Not in this PR

  • An oc --server receiver whose client dies mid-file keeps no partial; upstream keeps it on exit (cleanup.c:159-181). Tracked separately.
  • The "Unable to create partial-dir ... discarding" arm (receiver.c:1318-1325) is task 523.

upstream util1.c:1625 handle_partial_dir() creates the staging dir with
do_mkdir_at(dir, 0700). The network receiver's disk-commit path passed
0777, so the dir came out 755 under umask 022 on push and pull, where
3.5.1 makes it 700. The --backup-dir parents keep ACCESSPERMS
(backup.c:128, util1.c:241).
@oferchen

oferchen commented Nov 3, 2026

Copy link
Copy Markdown
Owner Author

Folded into #8304 (merge commit on fix/receiver-fatal-io-lines) so both land in one CI run.

@oferchen oferchen closed this Nov 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant