← Back to team overview

kicad-developers team mailing list archive

Auto-generated backup files: are they useful?


Currently, KiCad automatically creates backups of schematic and PCB
files when you save a file.

The logic for these backups is basically: if a file already exists
with the same name as what we are saving, copy that file to a new file
and give it the "-bak" suffix on the file extension.

These backups are stored next to the original file in the current
KiCad codebase.  This understandably creates clutter that some people
don't like (myself included) so in the project-settings branch that is
about ready to be merged, I changed this behavior to place all these
backups in a special backups folder for the project.

This proved to have some complications around the handling of files
outside the project path (which it's possible to have with
hierarchical schematic sheets) so I need to do something else.

After some thought, I am pretty convinced that the right thing to do
is just *remove this backup feature entirely*.  Here's why:

1) It's not a very good backup:  It just stores the state from the
last time you hit "save".  If you hit save again, your backup is blown
up.  So, it's really like a "undo" function, but on disk, and with
only one level of undo.

2) Recently I changed how we save schematic and board files to fix
some unrelated issues people were seeing with cloud backup services.
Before this change, if KiCad crashed or had some other serious error
while saving a file, the file would be lost (because we used to delete
the old file and then write a new one in its place).  After this
change, we write the new file to a temporary location, and only if
that write succeeds do we copy it on top of the old file.  I think
this vulnerability to generating corrupt files if we crash was one of
the reasons for this backup file system, and that reason is now gone.

3) Because it's not a very good backup, I worry that the fact that
"bak" files exist might cause some users to have a false sense of
security and not use a true backup system (like a version control
system, or some other mechanism that actually backs up files
periodically).  I want to remove this false sense of security so that
it is more clear that users should back up their files in some way if
they care about the work.

In other words, I don't think this feature actually gives enough value
to make it worth the clutter in the project folder and/or the
development effort to make it work well with less clutter.

So, I'd like to hear from others on this: anyone disagree?


Follow ups