mirror of
https://github.com/abraunegg/onedrive
synced 2026-03-14 14:35:46 +01:00
This change improves the robustness of safeRename() by adding bounded retry handling for transient filesystem errors and ensuring rename failures are handled safely and consistently.
**What changed**
* safeRename() now catches and handles std.file.rename() failures instead of allowing exceptions to propagate unexpectedly.
* The function retries rename operations when the underlying syscall returns:
* EINTR — interrupted system call (signal delivery before completion)
* EBUSY — temporary “resource busy” conditions
* Retries are capped and include a small backoff to avoid tight retry loops.
* EXDEV (cross-filesystem rename) is explicitly detected, logged, and not retried.
* Existing --dry-run behaviour is preserved.
**Why this is needed**
On POSIX systems (Linux and FreeBSD), rename() can legitimately fail with EINTR when a signal interrupts the syscall. Treating this as a hard failure leads to noisy logs and unnecessary operation aborts, particularly during shutdown, signal handling, or transient connectivity events.
In rarer cases, EBUSY may be returned due to temporary filesystem conditions. A limited retry avoids false failure reporting while still surfacing persistent or logical errors.
**Scope and behaviour**
* Applies to Linux and FreeBSD.
* No change to functional semantics for successful renames.
* Genuine error conditions (permissions, missing paths, cross-filesystem moves, etc.) are still logged and surfaced immediately.
* Aligns rename handling with the retry semantics recently added to safeRemove().
This brings safeRename() in line with POSIX-recommended handling for interruptible system calls while keeping retries bounded and safe.
|
||
|---|---|---|
| .. | ||
| actions/spelling | ||
| ISSUE_TEMPLATE | ||
| workflows | ||
| FUNDING.yml | ||