#83 Recover orphaned *.kdbx.tmp files automatically during synchronization

KeePass_2.x
open
nobody
None
5
2013-07-19
2013-07-19
Will R
No

There is a small window in the sync code where the old .kdbx file is deleted, but the .kdbx.tmp file is yet to be renamed. Over remote connections (or with buggy endpoints such as WebDAV) the rename can fail to complete.

This leaves the user with a deleted kdbx file and subsequently requiring manual renaming - which in turn breaks automatic triggering and other events connected to synchronization and remote files. This is most prevalent in Mono.

The attached patch adds a second-try error recovery in the event of a non-existent .kdbx file on import by automatically testing for the existence of .kdbx.tmp file on exception and performing the appropriate rename operation - but only if an existent kdbx is not found (to prevent overwriting good data with bad in case of a truncated tmp file).

1 Attachments

Discussion