You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sync download deletes the old local file before renaming the new one into place #655
After downloading to the .b2.sync.tmp file, the sync download action calls os.unlink on the existing local file and then os.rename. If the rename fails, the previous local copy is already gone. os.replace would swap the file in one step.
Where
b2sdk/_internal/sync/action.py:331-334 (B2DownloadAction.do_action, os.unlink at :333 and os.rename at :334).
Why it matters
Impact: Data, loud (the rename raises OSError). Severity: Low, because it needs a rename that fails after the unlink, and the downloaded data stays in the temporary file while the remote copy is intact.
How to check
Read the lines above; to see it, make os.rename raise (for example by a permission error on the target directory entry) and note the old file is missing. Found by reading the code, not reproduced.
Version
Seen at v2.13.4. Present on the default branch: present.
Activity