Closed NSSynapse closed 7 months ago
I can confirm that this also occurs on Linux (EndeavourOS), and I can add that maestral ls -l
contains the dates that the files were actually last modified.
Thanks for the report, I'll need to look into that.
This is happening to me with a a lot of files, and it's very disconcerting. I rely a lot on modification dates going back over 25 years, and this is an existential risk to my personal file management. 😳
I'm going to look into writing a script to fix up the file dates manually when possible, but this might be a dealbreaker for me using Maestral going forward. 😔
(Fortunately, the new modification date is not synced back to the Dropbox server, unless you move the file out of the synced folder and then back in.)
This is definitely a tad reassuring, but it's definitely still trouble for those of us who regularly refactor files. 😬
@samschott If a monetary bounty would help you prioritize looking at this, I'd be happy to pledge $200 towards a full fix.
Please don't pay that much! I've recently gone professionally into software engineering so had a bit less time to work on such hobby projects by the side. But I'll look into this bug, it should not be too difficult to reproduce and fix.
Please don't pay that much! I've recently gone professionally into software engineering so had a bit less time to work on such hobby projects by the side. But I'll look into this bug, it should not be too difficult to reproduce and fix.
Ah, don't sell yourself short, Maestral has saved me a lot of pain!
And I'm glad to see you dug right in and 1.8.1.dev1
already fixes this, which means I can recover my timestamps already, thanks. 🤩
EDIT: $200 sent, thanks again! 😻
Thanks for fixing this, looking forward to 1.8.1! I assume nuking the repository and resyncing will be necessary to repair incorrect timestamps?
Unfortunately, yes. Apologies for that! Though of course new edits to existing files will automatically sync with the correct timestamp applied.
If you are comfortable running Python scripts on your machine and have Maestral installed as a Python package, you could also correct the timestamps manually as follows:
import os
import time
from maestral.main import Maestral
from maestral.core import FileMetadata
m = Maestral()
entries_iterator = m.list_folder_iterator("/", recursive=True)
for entries in entries_iterator:
for entry in entries:
if isinstance(entry, FileMetadata):
local_path = m.to_local_path(entry.path_lower)
now = time.time()
mtime = min(entry.client_modified.timestamp(), entry.server_modified.timestamp())
try:
os.utime(local_path, (now, mtime))
except (FileNotFoundError, IsADirectoryError):
# File may be not yet synced or excluded
pass
Note that depending on the size of your Dropbox, fetching metadata for all remote items may take several minutes.
Maestral versions prior to 1.7.2 correctly preserved modification dates of files that were downloaded to the local Maestral folder on a Mac. In version 1.7.2 (and 1.7.3), this behavior regressed and now the modification date of downloaded files is set to the time they were downloaded.
To Reproduce:
Expected behavior: The original modification date of the file should be preserved.
Actual behavior: The modification date of the file is set to the time it was downloaded by Maestral. (Fortunately, the new modification date is not synced back to the Dropbox server, unless you move the file out of the synced folder and then back in.)
System:
Additional context: I discovered this regression when I downgraded to a clean install of Maestral 1.7.2 to avoid the zero-byte issue I reported in https://github.com/samschott/maestral/issues/926. After Maestral 1.7.2 had finished downloading my whole Dropbox to a new empty folder, I realized that all local files had their modification dates changed to a time within the 10-minute window it took Maestral to download all files. Backups of my Dropbox folder allowed me to see that the issue is also present in 1.7.3.
I then downgraded to Maestral 1.7.1 and let it sync to a new empty folder. There, all downloaded files have the correct original modification date.
These recent issues have reminded me how much I rely on Maestral and how much I appreciate all your work, so I would like to include a big thank you for all your efforts!