Recent

Author Topic: ??? How is this possible ???  (Read 3239 times)

J-G

  • Hero Member
  • *****
  • Posts: 953
??? How is this possible ???
« on: October 04, 2022, 09:37:27 pm »
Whilst working on my 'Energy' project a few days ago, I had a [Pop-Up] telling me that the source had 'changed on disc' - I would normally 'Ignore' but for some reason that button wasn't where I have seen it previously and instead I hit the [replace] button  :(

What I wasn't expecting was that the 'new' version was in fact a copy from APRIL !!

I spent far too long trying to recover but today I got back to where I was (though I did have two days without any coding)  -  Since I couldn't fathom how this anomoly might have happened, I was being ultra cautious so created a number of 'safe' folders where I made a copy of the code before each re-compile.  All went perfectly normally with each iteration until I was happy with the recovery.  At this point I had 9 back-ups and a 'live' folder.  Imagine my surprise at returning to my office after having my evening meal to see that the 'live' folder now contained the April files !!!

Further investigation brings even more confusion . . . .  The time-stamps show 'Date Modified = 25/4/2022' and 'Date Created = 4/10/2022'   utterly ludicrous  -  to make sure that the issue was not a silly 'time-stamp' problem, I viewed the .PAS file (which was still open in Lazarus) in NotePad++ and there is no doubt that the files are from April when some TLabels didn't exist.

Since I have the 9 backup folders  -  along with the still open project  -  I can very easily recover the project but I'd appreciate some thoughts upon how such behaviour is possible.

FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

Josh

  • Hero Member
  • *****
  • Posts: 1271
Re: ??? How is this possible ???
« Reply #1 on: October 04, 2022, 09:55:40 pm »
some thoughts.

Do you have the same project open by more than one running lazarus App, Do you have the multiple same pas file open in your project source editor,
if you have the files open in NotePad++ as well as in your project source editor, this can cause issues, especially if you have auto save/backup enabled in notepad++ even more so if you have the autosave plugin and auto refresh on change enabled.

The best way to get accurate information on the forum is to post something wrong and wait for corrections.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: ??? How is this possible ???
« Reply #2 on: October 04, 2022, 09:56:57 pm »
Multiple copies or multiple backup directories.?

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: ??? How is this possible ???
« Reply #3 on: October 04, 2022, 10:10:00 pm »
some thoughts.

Do you have the same project open by more than one running lazarus App, Do you have the multiple same pas file open in your project source editor,
if you have the files open in NotePad++ as well as in your project source editor, this can cause issues, especially if you have auto save/backup enabled in notepad++ even more so if you have the autosave plugin and auto refresh on change enabled.
Thanks for the thoughts Josh but regrettably all my answers are 'No'.

You have at least alerted me to the possibility that it might be down to NotePad++  . . . .   I hadn't considered that that may have a [backup] setting   -  I seldom use it and only did so to make a comparison  -  Now I have looked, the backup default is 7 seconds so there is certainly some potential for it to stamp over the 'live' code but in fact the backup path is to a totally different hard drive. Even so, I have now turned that option off - it won't be of any consequence since (as I've said) I don't 'use' it.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: ??? How is this possible ???
« Reply #4 on: October 04, 2022, 10:12:11 pm »
I've run into "hard to explain" situations like you described.  It is usually caused by the fact that, as a matter of course, I use two editors to edit source code _and_ the fact that Lazarus keeps backup copies of files in a directory called "backup".

Sometimes, I've seen Lazarus restore a file from its "backup" directory for reason(s) that still remain unclear to me.

One of the things I do to prevent the problem from happening is, after making a full backup of the files in a directory usually named "vXX" (where XX is a sequential number), I delete all the files in Lazarus's "backup" directory.  That has minimized the number of times I've been surprised by the spontaneous resuscitation of a file.

HTH.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Bart

  • Hero Member
  • *****
  • Posts: 5275
    • Bart en Mariska's Webstek
Re: ??? How is this possible ???
« Reply #5 on: October 04, 2022, 10:19:04 pm »
Yet another reason to use a version control system.
If shit happens one day, you simply revert to the last commit.

Bart

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: ??? How is this possible ???
« Reply #6 on: October 04, 2022, 10:26:35 pm »
I've run into "hard to explain" situations like you described.  It is usually caused by the fact that, as a matter of course, I use two editors to edit source code _and_ the fact that Lazarus keeps backup copies of files in a directory called "backup".

Sometimes, I've seen Lazarus restore a file from its "backup" directory for reason(s) that still remain unclear to me.

One of the things I do to prevent the problem from happening is, after making a full backup of the files in a directory usually named "vXX" (where XX is a sequential number), I delete all the files in Lazarus's "backup" directory.  That has minimized the number of times I've been surprised by the spontaneous resuscitation of a file.

HTH.
Well,  that is somewhat reassuring  -  I have cleared out the [Backup] folder on one occasion but, being cautious, copied it to a a [Backup 2] directory - without telling Lazarus that that folder existed - I also changed the number of backups from 9 to 'infinity' but seeing your comment I think I'll make the 'clear out' my mantra.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: ??? How is this possible ???
« Reply #7 on: October 04, 2022, 10:39:12 pm »
Yet another reason to use a version control system.
If shit happens one day, you simply revert to the last commit.
Bart
:D touché :D

It so happens that I do have Tortoise Installed - I think it was lainz who suggested it but (if I recall correctly) that was to allow him to see the full project ( a graphic program in 2016). I've not used it since.
FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: ??? How is this possible ???
« Reply #8 on: October 05, 2022, 12:35:36 am »
I forgot to mention...

When I delete the files in the Lazarus backup directory, I make it a point to keep the backup of the ".lpi" and ".lps" files.  Those aren't likely to cause a problem and having them backed up is nice, just in case.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2786
    • tomboy-ng, a rewrite of the classic Tomboy
Re: ??? How is this possible ???
« Reply #9 on: October 05, 2022, 01:36:36 am »
Hmm, keeping multiple manual backup folders is a risky way to work in my opinion, sooner or later you make a mistake. I agree that using a local VCS is far better as it presents a linear history, all in one place with clear deliberate steps to bring something back. Pushing that VCS to an external server is even better !

OTOH, I sometimes think that Lazarus's ability to 'publish' the current project as a zip could be extended to have a date stamp and allow multiple snapshots in the publish directory, less controlled than a real vcs but easier for lightweight project perhaps ?

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

ezlage

  • New Member
  • *
  • Posts: 32
  • Silence is the perfect beat!
    • GitHub
Re: ??? How is this possible ???
« Reply #10 on: October 05, 2022, 01:51:37 am »
I tried working in sync with Google Drive for a while, but I was experiencing strange things like this. If you're using Windows, see if, by chance, in the properties of any upper folder that hasn't been renamed, you can find shadow copies in the "Previous Versions" tab.

440bx

  • Hero Member
  • *****
  • Posts: 3944
Re: ??? How is this possible ???
« Reply #11 on: October 05, 2022, 02:13:25 am »
Hmm, keeping multiple manual backup folders is a risky way to work in my opinion, sooner or later you make a mistake. I agree that using a local VCS is far better as it presents a linear history, all in one place with clear deliberate steps to bring something back.
I've tried various VCS in the past and, to me, they produced more hassles than solutions.  Basically, to me, they lower productivity.

That said, I think it's perfectly reasonable to use one.  I just find the alternative simpler and more straightforward.
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

circular

  • Hero Member
  • *****
  • Posts: 4195
    • Personal webpage
Re: ??? How is this possible ???
« Reply #12 on: October 05, 2022, 04:13:09 am »
About the modification and creation date, it is possible indeed that the modification date be before the creation date. When you copy an old file to a new destination, the creation date can be today, because the destination is created at this moment. It can be tweaked to be the same as the creation date of the source, but not always.
Conscience is the debugger of the mind

dseligo

  • Hero Member
  • *****
  • Posts: 1195
Re: ??? How is this possible ???
« Reply #13 on: October 05, 2022, 09:49:28 am »
In my opinion this is very strange behaviour and you should try to find cause for this, other than cure the problem.
Recently you had problems with incorrect procedure being called, maybe this is connected.
Check if you some backup software installed which could cause this (or some other file system related tools).
Ezlage mentioned Google drive, check also if you have MS Onedrive or some other similar software.

J-G

  • Hero Member
  • *****
  • Posts: 953
Re: ??? How is this possible ???
« Reply #14 on: October 05, 2022, 02:47:15 pm »
There have been some very useful points made and no doubt they may well be useful to others who may stumble upon this thread in future.

Personally, I am somewhat 'old school' having started my computing on a Nascom II with no disc drive. When I did get a single side 170k floppy drive (5¼"), there was no Operating System - just the raw 'Go to track X sector Y, read 128 bytes'  and with that I wrote a point-of-sale system to control my DIY Supplies shop!

I've never had any truck with MS OneDrive, GoogleDrive or any other such application - well not since I had a disagreement with a Western Digital 'OneDrive' system which thought that it knew what I wanted to do better than I did!  :(  - - -  I do have 'SyncBack' which has been dealing with backing up of many drives over many PCs on my network for many years but I would certainly not want any of my data on 'The Cloud' !!

I should have appreciated @Circular's point about creation/modified date as well  :-[

I'll simply keep my eye on the dates before I open any project  -  how long that will be remembered is to be tested  :o

Thanks for all the input.



FPC 3.0.0 - Lazarus 1.6 &
FPC 3.2.2  - Lazarus 2.2.0 
Win 7 Ult 64

 

TinyPortal © 2005-2018