Thaddy, it actually does set the write protected file to size 0.
Then Lazarus has write access to that file.
Yes. I already tried to explain that. There is write access, otherwise the file can never be created or change in size.
There must be something else that causes this.
I suppose a scenario may be that Lazarus can not create a NEW back-up file, since it has a default file name.
Since the order is Create, back-up, then copy to create a working copy (to prevent data loss, that is the correct order) you'll end up with an unusable, empty file.
So the cause is that the back-up can not be created under its default name.
This is by design indeed. The back-up mechanism needs write access. It is a back-up as a starting point when the file is opened, not a back-up meant for permanent storage. The semantics are not clear here but I hope you understand that there are multiple ways to define "back-up"
The solution is to rename the old back-up or move it to a safe place.