dpradov / keynote-nf

Tabbed notebook with RichText editor, multi-level notes and strong encryption.
Mozilla Public License 2.0
241 stars 56 forks source link

Problems when synchronising Keynote files through Dropbox #681

Open s427 opened 2 months ago

s427 commented 2 months ago

I'm using Dropbox to sync my KN files between home and work, and I often find that the changes that I make on one side are lost when I want to continue work on the other side. Fortunately, I'm usually able to restore them by searching in the backups that are created by Keynote.

I'm having a bit of a difficult time figuring out what causes the issue, and I'd be curious to know if other users experience the same problem.

Setup

Here's my setup (on both sides, home and work):

Recent example of work being almost lost when syncing

  1. I am at work, and I make some changes to the travail.kne file.
  2. I get back home, wake up my computer. At this point it should be noted that KeyNote is already running in the background, with the same file already opened.
  3. I do not make any change to this file when I am back at home.

What I would expect at this point is:

As far as I can tell, Dropbox does sync the files: I can at least see that the backups performed at work (in backup/work) are now available at home.
But Keynote does not inform me that there has been changes to the travail.kne file, and keeps showing me the old version of this file.
If I switch to another KN file and then back to travail.kne in order to manually reload it, the result is the same: my changes from "work" are nowhere to be seen. It's as if the file hasn't been synced by Dropbox, but I don't think that's true.

Now if I dig into the backup folders, I can find my changes. This is where it gets interesting and a bit confusing:

That is all I can find in backup/work. This checks out with the idea that the latest changes should be found directly in travail.kne (not in a backup folder).

If I look into the backup/home folder:

Notice that "BAK@W1" (11:05) is more recent than "BAK_Day" (10:44), but the data it contains is older.
The main travail.kne has the same timestamp as "BAK@W1" (11:05).

So to me it looks like:

So (unless I'm mistaken somewhere), the issue is that Keynote not only seems to ignore the file updated by Dropbox, but also (why???) backs up this file and re-save the old one (currently opened), overwriting the newer one. It's very strange.

dpradov commented 2 months ago

I would ask myself, what time did Dropbox synchronize on home? Also, there should be no risk of losing any data if you are saving everything in Dropbox, the originals and the backups, since Dropbox itself saves up to 30 versions (if I remember correctly) of each file. And the same with deleted files, you should be able to access them for a while as well. You can check it from your Dropbox account in the web. There you will have an exact picture of what happened. Whatever you see, if you find anything attributable to KeyNote, let me know and I'll look at it.

That said, the detection of file modification is not clear to me if it is foolproof. I would have to review how it is implemented in case it needs any adjustments. This is the mechanism that was available in version 1.6.5 and for now I have not seen the need to change it.

I understand that you have looked at the description of how the backup works in the help (Backup at regular intervals), where an example of how it works is added.

⦁ A copy of the file will be created with the first modification on each month. This files will not be deleted from KN. ⦁ Idem with the first modification on each week. This files will be replaced with the corresponding ones on succesive months. If a week contains a monthly backup then no weekly file will be created. ⦁ With the first save on a new day, a backup of the file before saving will be created (if it is'nt available as a weekly or monthly backup) as a distinguished file.

<<backup/home/travail_BAK_Day.knt (Today, 10:44): contains ALL my latest changes from work>>

The _BAK_Day file contains the version of the file before any modification to the application. To do this, the current version on disk is renamed when saving the new version (in your case the file already synchronized). What must have happened is that the application has not detected the change in the file due to Dropbox synchronization. Therefore, the version in memory, when saved would not have the work changes. And if KeyNote did the saving, it is because some change in the file would have been identified (may an alarm have gone off, for example?)

In any case, I recommend that if you are going to work with the same file from two different places, you make sure to close the document when you move from one environment to another, for security. Even other applications, such as Keepass, in analogous situations do not recommend working directly with the file synchronized in Dropbox, but with a copy in another folder, which is then synchronized over the version in the synchronized folder. Keynote does not have the Keepass functionality of allowing you to synchronize individual changes made from another instance, but the risk of changes from one instance crushing those from the other is the same.

Regards

s427 commented 2 months ago

Thanks for the clarification.

No, I don't use alarms. I really don't see what could have triggered KN to save the old version of the file.

I've activated the option to "close Notes file after [30] minutes idle". I hope it will help.

A suggestion would be to add a similar option when the computer:

So, close any opened file in those situations. Would that be possible?

s427 commented 2 months ago

I've activated the option to "close Notes file after [30] minutes idle". I hope it will help.

With this option activated (30 minutes), I'm wondering what would happen in the following situation:

By that time, more than 30 minutes have passed since the first step in real life. But since the computer has been asleep for most of that time, will Keynote realize that and close that file? Or has its timer be put on pause as well, so it will wait another 20 minutes before it reaches the 30 minutes required before it closes the file?