Skip to content

Safe building #1124

Description

@Evidlo

In PyKeepass we wrap build_file with a write to a temporary file followed by a file move to prevent the database from being corrupted during building if there's an exception

I imagine this is a fairly common design idiom (any build-time exception is guaranteed to corrupt if overwriting original data), so I was wondering if this might be worth making it built-in, or if you think it is out of scope.

There are performance tradeoffs of course (requires storing to another file/buffer before moving/copying), so it would need to be behind a flag safe=True or something.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions