Pressing Escape when Lazarus can't write a file = data loss lazarus / 13-General ---------------------------------------------------------------------- Girlbrush · 2017-01-24 13:16 When a file is write-protected (needing a SVN checkout or similar), Lazarus' error message will close the whole IDE down without saving anything if you hit Escape or the Cancel option. Is this intended behaviour? Would be better if it had an option for crash recovery. ---------------------------------------------------------------------- Girlbrush · 2017-01-25 10:51 Another thing - when a files backup is write-protected, Lazarus will make the actual size 0 when attempting to write to it  Problematic when it's the .lps and so on. Luckily, we can revert through SVN. ---------------------------------------------------------------------- Thaddy · 2017-01-25 10:59 Quote from: Girlbrush on January 25, 2017, 11:51:26 amAnother thing - when a files backup is write-protected, Lazarus will make the actual size 0 when attempting to write to it  Problematic when it's the .lps and so on. Luckily, we can revert through SVN. That's not possible: then it is not write protected... Maybe that Lazarus internally handles the file as zero bytes (correct) , but if the file is write protected it can not change the file size on storage. Laz version, OS version, FPC version,plz? ---------------------------------------------------------------------- Girlbrush · 2017-01-25 14:03 Quote from: Thaddy on January 25, 2017, 11:59:50 amThat's not possible: then it is not write protected... Maybe that Lazarus internally handles the file as zero bytes (correct) , but if the file is write protected it can not change the file size on storage. Laz version, OS version, FPC version,plz? I didn't phrase the problem very well - if the backup file is write- protected, then the not-backup file (.lps for example) is set to zero. Sorry, I forgot to add: Windows 10 Pro x64 Lazarus 1.6.2 r53354 FPC 3.0.0 x86_64-win64-win32/win64 ---------------------------------------------------------------------- Girlbrush · 2017-01-31 06:42 Quote from: Thaddy on January 25, 2017, 11:59:50 amQuote from: Girlbrush on January 25, 2017, 11:51:26 amAnother thing - when a files backup is write-protected, Lazarus will make the actual size 0 when attempting to write to it  Problematic when it's the .lps and so on. Luckily, we can revert through SVN. That's not possible: then it is not write protected... Maybe that Lazarus internally handles the file as zero bytes (correct) , but if the file is write protected it can not change the file size on storage. Laz version, OS version, FPC version,plz? Thaddy, it actually does set the write protected file to size 0. I just had it happen to the .lps file - after that, the project won't open (thank god for SVN). ---------------------------------------------------------------------- balazsszekely · 2017-01-31 06:46 QuoteThaddy, it actually does set the write protected file to size 0. Then Lazarus has write access to that file. ---------------------------------------------------------------------- Thaddy · 2017-01-31 07:04 Quote from: GetMem on January 31, 2017, 07:46:16 amQuoteThaddy, 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.