mirror of
https://github.com/restic/restic.git
synced 2026-11-21 13:02:42 +00:00
In UpgradeRepo, if upgradeRepository fails, the error handler attempts contingency rollback by re-uploading the original config file. However, the contingency path unconditionally executed repo.be.Remove(ctx, h) before calling repo.be.Save. On backends supporting atomic replacement (such as local filesystems), a failed upgrade (e.g. out-of-disk-space or permissions error while writing the temporary file) leaves the original, valid version 1 configuration file completely intact on disk. Unconditionally removing the config file during rollback actively deletes the working configuration. If the subsequent Save call also fails, the repository is left permanently corrupted without a config file. Condition the pre-removal on !repo.be.Properties().HasAtomicReplace, matching the forward upgrade path in upgradeRepository. Add a unit test asserting that aborted upgrades on atomic backends preserve the intact original configuration. --------- Co-authored-by: Michael Eischer <michael.eischer@fau.de>
11 lines
528 B
Plaintext
11 lines
528 B
Plaintext
Bugfix: Improve silience of repository v2 upgrade rollback
|
|
|
|
When upgrading a repository from version 1 to 2, an aborted migration
|
|
attempted contingency rollback by unconditionally removing the configuration
|
|
file before re-saving it. On atomic backends (such as local filesystems),
|
|
the original configuration was intact, and deleting it during a failed rollback
|
|
left the repository unopenable. Restic now conditions config pre-removal
|
|
on whether the backend lacks atomic replacement.
|
|
|
|
https://github.com/restic/restic/pull/22136
|