nextcloud / desktop

💻 Desktop sync client for Nextcloud
https://nextcloud.com/install/#install-clients
GNU General Public License v2.0
3.03k stars 797 forks source link

[Bug]: Cannot sync files with modification year before 1970 #5196

Open tvwerkhoven opened 1 year ago

tvwerkhoven commented 1 year ago

⚠️ Before submitting, please verify the following: ⚠️

Bug description

I get an error "Cannot sync due to invalid modification time" for files with timestamps before the year 1970.

I use modification time to sort my (old) photos chronologically, and this doesn't work for photos from before 1970 on next cloud, while both filesystems support it.

N.B. this issue is different than https://github.com/nextcloud/desktop/issues/4378 where nextcloud seems to corrupt modification dates. Here the modification date is untouched but the file is not synced.

Steps to reproduce

  1. Have a file with modification date <1970, e.g. echo "hello world" >> hello.txt && touch -t 197001010000 hello.txt
  2. Try to sync
  3. Client gives an error 'Cannot sync due to invalid modification time'

Expected behavior

  1. Have a file with modification date <1970, e.g. echo "hello world" >> hello.txt && touch -t 197001010000 hello.txt
  2. Try to sync
  3. Client syncs

Which files are affected by this bug

All files with modification time <1970

Operating system

Mac OS

Which version of the operating system you are running.

macOS 12

Package

Appimage

Nextcloud Server version

24.0.6snap1

Nextcloud Desktop Client version

Version 3.6.2 (macOS)

Is this bug present after an update or on a fresh install?

Updated from a minor version (ex. 3.4.2 to 3.4.4)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

Are you using an external user-backend?

Nextcloud Server logs

No response

Additional info

No response

tuxayo commented 1 year ago

Same issue on EndeavourOS (Arch Linux derivative) with nextcloud 3.7.1 arch linux package.

I have files dated on Jan 1 1970 because I got them from an Android phone in recovery mode I think. So MTP didn't have all the info.

tuxayo commented 1 year ago

I could fix the date on the files but it's certain that there are other people with failures in loop during all day that don't know that and would benefit from the client/server sorting that out by itself.

It's been months I have these notifications multiple times per day and only today I checked to find out it's not the usual 503 errors I have since more than 8 years that I'm using nextcloud/owncloud on my self hosted install.

rklasen commented 1 year ago

I can confirm the bug on Arch:

Nextcloud Desktop Client
Version 3.10.1 (Arch). For more information please click [here](https://docs.nextcloud.com/desktop/3.10/).
Using virtual files plugin: suffix

arch-6.5.9-arch2-1

The problem occurs quite often in my case because Thingiverse stl files have a modification time stamp of 1.1.1970, so unix time 0. I have to run fd --changed-before=1971-01-01 -x touch each time I add another Thingiverse stl to my Nextcloud folder.

gamerkonks commented 2 months ago

I have a collection of media files which have thier modification date automatically set to the release date of the media. For media that was release prior to 1970, it gets set to 01-01-1970. This is expected. I have my Nextcloud desktop client setup to use VirtualFiles. I continually get sync errors saying cannot sync due to invalid modification time. Why is 01-01-1970 invalid?

rklasen commented 3 weeks ago

I suspect Nextcloud is using unix timestamps so store dates internally, and those basically count the milliseconds since 01-01-1970. So a unitx timestamp of 0 is exactly that date, presumably midnight. I don't think negative timestamps are common. I can only guess, but it seems they are usually stored as unsigned long.

@gamerkonks Now, for you specific issue: while I understand the idea behind setting the creation date of the media to it's canonical release date, that's not the the intention behind a file creation date. That really should be the creation of the actual file. Release date information is more suited in some meta data field.

InfamousUser commented 1 week ago

I have an error with dates after now. Throws an error while syncing: "Cannot sync due to invalid modification time"