← Back to team overview

zim-wiki team mailing list archive

Re: Failing operations - how does ZIM handle them?

 

On Mon, Jul 15, 2013 at 5:58 PM, Klaus-Dieter Bauer <
bauer.klaus.dieter@xxxxxxxxx> wrote:

> Related to https://bugs.launchpad.net/zim/+bug/1178604: Does ZIM
> currently implement some safety net for failing operations?
>
> I have seen similiar bugs before, where some step of the renaming (moving
> the attachment folder, renaming the txt file, updating links in other
> pages...) would fail, usually due to file locks from some program (e.g. a
> shell being in a subdirectory of the page).
>
> I used to thing of these as Windows-specific bugs, since sadly Windows
> programs tend to take very strong file locks, making renaming of
> directories with files being accessed by some program impossible and even
> finding out what program interferes requires special software. The
>
> Though I didn't yet observe a loss of data, such incidents tend to cause
> broken links at least.
>


Zim has a very strong mechanism to prevent files from disappearing. See the
code in zim/fs.py for the detailed implementation. We never delete a file
before it's replacement is written. Same logic applies for moves etc.

Broken links can occur because we can fail in the middle of an multi-file
update. All the files are still there, but links may not updated properly.
This is not really preventable because there is no way to update multiple
files all at once. Best way to deal with this would be to have a "repair"
function to update links.

In either case I always advice to enable the version control plugin - that
way you can always revert changes to the last saved version.

Regards,

Jaap

References