* * *

Author Topic: Pressing Escape when Lazarus can't write a file = data loss  (Read 1081 times)

Girlbrush

  • Jr. Member
  • **
  • Posts: 65
Pressing Escape when Lazarus can't write a file = data loss
« on: January 24, 2017, 02:16:46 pm »
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.
Getting back into programming after 8+ years.

Girlbrush

  • Jr. Member
  • **
  • Posts: 65
Re: Pressing Escape when Lazarus can't write a file = data loss
« Reply #1 on: January 25, 2017, 11:51:26 am »
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.
Getting back into programming after 8+ years.

Thaddy

  • Hero Member
  • *****
  • Posts: 3971
Re: Pressing Escape when Lazarus can't write a file = data loss
« Reply #2 on: January 25, 2017, 11:59:50 am »
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.
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?
« Last Edit: January 25, 2017, 12:02:42 pm by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

Girlbrush

  • Jr. Member
  • **
  • Posts: 65
Re: Pressing Escape when Lazarus can't write a file = data loss
« Reply #3 on: January 25, 2017, 03:03:58 pm »
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?

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
Getting back into programming after 8+ years.

Girlbrush

  • Jr. Member
  • **
  • Posts: 65
Re: Pressing Escape when Lazarus can't write a file = data loss
« Reply #4 on: January 31, 2017, 07:42:07 am »
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.
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).
Getting back into programming after 8+ years.

GetMem

  • Hero Member
  • *****
  • Posts: 2134
Re: Pressing Escape when Lazarus can't write a file = data loss
« Reply #5 on: January 31, 2017, 07:46:16 am »
Quote
Thaddy, it actually does set the write protected file to size 0.
Then Lazarus has write access to that file.

Thaddy

  • Hero Member
  • *****
  • Posts: 3971
Re: Pressing Escape when Lazarus can't write a file = data loss
« Reply #6 on: January 31, 2017, 08:04:44 am »
Quote
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.
« Last Edit: January 31, 2017, 08:16:32 am by Thaddy »
"Logically, no number of positive outcomes at the level of experimental testing can confirm a scientific theory, but a single counterexample is logically decisive."

 

Recent

Get Lazarus at SourceForge.net. Fast, secure and Free Open Source software downloads Open Hub project report for Lazarus