← Back to team overview

kicad-developers team mailing list archive

Re: Auto-generated backup files: are they useful?


That save process change is what I was referring to in (2)

The old save process (in 5.1 and earlier) is:

1) Move (not copy) filename.ext to filename.ext-bak
2) Write the save to filename.ext (a new file at this point)

Our current save process (in nightlies) is:

1) Copy filename.ext to filename.ext-bak
2) Write to .filename.ext$ (a temporary file)
3) If everything worked, move .filename.ext$ to filename.ext
(overwrites the old file)

There is no need to delete anything: if the save works, the move
option effectively deletes the temporary file.  If the save doesn't
work, the old file is untouched.

On Mon, Jun 29, 2020 at 3:27 PM Andrew Zonenberg
<azonenberg@xxxxxxxxxxxxxxx> wrote:
> I find them annoying and have to add them to my gitignore's etc constantly.
> They're of no value to me because I tend to save every 30 seconds or so
> while working.
> The *one* thing they might be useful for is guarding against kicad
> segfaulting or other failures (disk full, NFS connection lost, etc)
> during the save process itself. To do this, I'd suggest:
> * Move old file to file.bak
> * Write new file
> * Delete old file if everything worked. If something goes wrong before
> reaching this point, you can restore from the bak.
> On 6/29/20 12:23 PM, Jon Evans wrote:
> > 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?
> >
> > Thanks,
> > Jon
> >
> > _______________________________________________
> > Mailing list: https://launchpad.net/~kicad-developers
> > Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> > Unsubscribe : https://launchpad.net/~kicad-developers
> > More help   : https://help.launchpad.net/ListHelp
> >

Follow ups