Skip to content

fix: make sync finalization atomic, clean temp files on error, and escape paths in messages - #715

Merged
ffumero2003 merged 2 commits into
masterfrom
fix-python-low-audit-sync-finalize
Nov 21, 2026
Merged

ffumero2003 merged 2 commits into
masterfrom
fix-python-low-audit-sync-finalize

Conversation

@ffumero2003

Copy link
Copy Markdown
Contributor

Context

Sync downloads can remove the existing local file before finalizing its replacement, and failed downloads can leave misleading timestamps or temporary files. Download and copy completion messages can also contain unescaped control characters.

Changes

  • Replace the destination atomically and clean up failed temporary downloads while preserving the original error.
  • Set downloaded-file modification times only after successful writes and escape paths in download and copy completion messages.
  • Enable the C3, C17, and C24 regression tests and add a bugfix changelog fragment.

Verification

  • Reproduced all five C3, C17, and C24 regression failures on master; the affected regression file now passes (7 tests).
  • python -m pytest -p no:cacheprovider test/unit -q: 1,257 passed, 77 skipped, 14 xfailed, 94 subtests passed.
  • Ruff lint passed; changed-file formatting and the towncrier check passed.

Refs #711

@ffumero2003 ffumero2003 self-assigned this Nov 21, 2026
@ffumero2003
ffumero2003 requested a review from goanpeca November 21, 2026 22:50
@coderabbitai

coderabbitai Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

This organization requires a seat for paid usage-based reviews, including automatic and on-demand reviews. Ask an admin to assign a seat or enable paid usage-based reviews for users without a seat in Billing.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 2 included reviews currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 28d51fea-3fd1-42db-bf76-386c65c4151f
Commits

Reviewing files that changed from the base of the PR and between be0814d and 59dc74f.

Files selected for processing: 4

  • b2sdk/_internal/sync/action.py
  • b2sdk/_internal/transfer/inbound/downloaded_file.py
  • changelog.d/+sync-finalization.fixed.md
  • test/unit/sync/test_regression_sync_actions.py
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@ffumero2003
ffumero2003 merged commit 6578b80 into master Nov 21, 2026
29 checks passed
@ffumero2003
ffumero2003 deleted the fix-python-low-audit-sync-finalize branch November 21, 2026 23:33
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