Zettlr / Zettlr

Your One-Stop Publication Workbench
https://www.zettlr.com
GNU General Public License v3.0
10.2k stars 625 forks source link

[Bug] Deleted files are constantly being recreated #2308

Closed mangomaluca closed 2 years ago

mangomaluca commented 3 years ago

Description

Hi, I love using zettlr. The only issue I am having is I am unable to delete old files (I know that the zettelkasten method encourages you to keep all files, but what about "test" files or "duplicate" files - they will create confusion later and should be deletable!).

I know that when you simply right-click "delete" on them in the directory, they don't actually get deleted but only removed, and will be re-loaded next time the program refreshes (so far so good, that's not a bug, although I do find it misleading that the function is still called "delete", and shouldn't there be a possibility to delete old zettl's from within zettlr...?)

But even if use the explorer to go to the folder that contains my zettls directly, delete the respective zettl .md-file there, I find that it does get moved to the trash AND the next time zettlr refreshes the file is also recreated in the zettlr directory - effectively, the file is duplicated, I now have one version in the trash, and one in zettlr.

[I know that it is possible to activate the 'hard delete' function in the preferences, but I am not looking for a 'hard delete' function, I am looking for a regular possibility to delete files such that they would be moved to the trash and remain there.]

I've even tried to work-around the problem by instead of deleting old files, simply overwriting them. But even if I do that, i.e., I give them a new name while the UID remains the same, delete the text the file contained and write new one into it, I find that this effectively duplicates the file: the old file is recreated and I now have a new one with the new information, too. (although when I simply write new information into an old zettl, it updates correctly, it is only when I try and change the file name that the files are duplicated)

What am I doing wrong? Thanks so much for any insight you can provide, and let me know if any further specific information would be helpful.

Reproducing

Zettlr Version

Beta (if applicable)

Specify version

2.2.0-beta.1

Your Platform

Architecture

Operating System Version

Windows 10

Additional Information

No response

boring-cyborg[bot] commented 3 years ago

Thanks so much for opening up your first issue here on the repository! 🎉 We would like to warmly welcome you to the community behind the app! ☺️ We'll check in soon and have a look at your issue. In the meantime, you can check your issue and make sure it aligns with our contribution guidelines! Here's the comprehensive list:

Enhancements

An enhancement takes a feature and improves or alters its behaviour. Please make sure to argue how your proposition will aid non-technical text workers, and why it can't be emulated easily with other features or apps!

Feature requests

Feature requests introduce whole new features into the app. This requires a lot of work, so these might be turned down if the implementation costs supersede the benefits we expect to see from implementing it. Please do not be disappointed if that happens. It likely has nothing to do with your great request but simply with us and our missing resources! You can of course always ask someone to implement this feature, because a PR with a working new feature has much higher chances of being merged! :)

Bug reports

Please note that one of the main reasons for why bug reports cannot be addressed is that there's not enough information for us to find and fix the bug you describe, so make sure you try to pinpoint the bug as close as possible. The ideal bug report for us has two qualities:

  1. The bug is always reproducible, at least within a certain context. 2. We know exactly what specifically goes wrong, and there is consensus on what should happen instead.

Please note that if you encounter behaviour that does not align with your expectations of what would happen, this might as well be simply intended behaviour and we need to simply clarify why the behaviour is the way it is. This is not to be considered a bug and such issues may be closed! Suggest an enhancement instead! But now, have a great day and thank you again!

nathanlesage commented 3 years ago

Thinking about the problem more, could it be that you are using some cloud service (Dropbox, iCloud, OneDrive) to back up your files? Because there's no code that would accidentally recreate any file (and yes, deleting files from within Zettlr is a thing, the "Delete" button will move your file to trash), but I can imagine that a somewhat malfunctioning cloud provider might not see that the file is deleted, think it needs to be put there, and download it again. Could that be a possibility?

mangomaluca commented 3 years ago

Thanks for checking in. Yes, that might be a possibility. I am using SpiderOak. Since I had seen in many places that other people seem to use Zettlr with cloud-based back-up solutions like Dropbox etc, I thought that it should work, but then again, this does sound like a likely solution. The other thing I had been thinking about is whether it was automatically recreating old files because their ID was still linked on some of the other zettls, but I have made sure to search for and delete all links and it still kept happening… I have in the meantime created a new directory and simply copied all the Zettl’s I wanted to keep into it, then deleted the old directory folder manually completely. And, it seems that the new directory is working well – however, the old folder with the old zettls keeps being recreated at odd intervals, as well.

Do you have any experience with integrating Zettlr and Spideroak, or any recommendation how to get around the resulting issues? Of course I can always store the Zettelkasten somewhere locally instead of in a syncing folder, but it would be great to have a possibility of backing it up. Are there other services that cause less problems? (I want to avoid dropbox, onedrive, etc if I can. It also doesn’t have to be cloud-based, I have been using syncthing for my library, too)

Thanks so much for looking into this, I really appreciate it!

nathanlesage commented 3 years ago

Do you have any experience with integrating Zettlr and Spideroak, or any recommendation how to get around the resulting issues?

Some cloud providers unfortunately pose a few problems. Zettlr itself only uses the default "syscalls", that is, it tells the operating system "Please create/rename/move/remove/change this or that file". It deliberately does not touch any metadata, since that is being used by cloud providers to check what needs to be synced.

We've in the past figured out that OneDrive apparently uses some weird mechanisms to determine that, leading to OneDrive frequently overwriting files because it apparently thinks that those files (which the users just edited) were older than the (actually outdated) files on the server.

It is likely that something similar is happening with SpiderOak.

I can only say that I never heard of problems relating to Nextcloud, Dropbox, and Google Drive. So I think these providers should be safe to use.

Would you mind, just for testing purposes, to try out one of these providers? If the issue doesn't appear there it might indeed be a problem with SpiderOak.


What could also be a problem might be that maybe your computer's clock is out of sync? I can really imagine that being a problem – if your computer's clock is slightly off from whatever the servers of SpiderOak see, that might be the cause. Imagine one file being edited at 12:12:11 computer time, uploaded to the server, the server sees the current time as 12:12:20, so the file on the server will have the date set to 12:12:20 instead of 12:12:11. Then you edit the file at 12:12:15 (four seconds later), SpiderOak realizes that the file has been changed, compares your local timestamp of 12:12:15 with the server one (12:12:20 instead of 12:12:11) and thinks that the server file is newer since it has a newer timestamp, thus overwriting your changes.

nathanlesage commented 2 years ago

Is this still an issue?

nathanlesage commented 2 years ago

Closing due to inactivity