nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.56k stars 4.08k forks source link

[Bug]: Incorrect mtime #48681

Open ChristophWurst opened 1 month ago

ChristophWurst commented 1 month ago

⚠️ This issue respects the following points: ⚠️

Bug description

I'm updating a text file once a week. I noticed that the last modified time in Files shows Two months ago while I made modifications very recently. Activity confirms the edits.

Image

Steps to reproduce

  1. Create a text file
  2. Edit the file through Text once a week

Expected behavior

Last modified says A week ago

Nextcloud Server version

30

Operating system

None

PHP engine version

None

Web server

None

Database engine version

None

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

None

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?

Configuration report

No response

List of activated Apps

No response

Nextcloud Signing status

No response

Nextcloud Logs

No response

Additional info

No response

skjnldsv commented 3 weeks ago

Can you check the response from dav please? To make sure this is a frontend rendering issue?

ChristophWurst commented 3 weeks ago
<d:getlastmodified>Thu, 29 Aug 2024 13:21:13 GMT</d:getlastmodified>
<d:creationdate>1970-01-01T00:00:00+00:00</d:creationdate>

I edited the file today.

skjnldsv commented 2 weeks ago

So that looks like a server issue? If you edited today, the getlastmodified is wrong 🤔

ChristophWurst commented 2 weeks ago

Correct

skjnldsv commented 2 weeks ago

CC @juliusknorr @max-nextcloud @mejo- I tried locally and it's synced properly here. The db gets updated.

No idea why it is not updated here 🤔 Moving to https://github.com/nextcloud/text maybe?

mejo- commented 2 weeks ago

@ChristophWurst could you check the actual entry in oc_filecache and also the file on the filesystem? Maybe the file didn't get written to the filesystem for some reason, which then would be an issue in Text indeed.

nickvergessen commented 2 weeks ago

Folder name contains a : so might not be synced anymore?

ChristophWurst commented 2 weeks ago

and also the file on the filesystem? Maybe the file didn't get written to the filesystem for some reason, which then would be an issue in Text indeed.

The file contains my changes, at least when I open it with Text but also when I download it with the browser.

I do not sync this directory to my computer, so not sure if this would sync or not. But as Joas said, the file contains a :. It looks like the changes from Text are written, but mtime is not updated?!

juliusknorr commented 2 weeks ago

Text does nothing specific there, we just call putContent where the regular cache update should take care of passing the mtime:

https://github.com/nextcloud/text/blob/3238541dc6c1587558aa63174a96ea3cc7818cbb/lib/Service/DocumentService.php#L390 https://github.com/nextcloud/server/blob/dc13f9cc1e3d8dce1c18d2c7920afe99b7bfa475/lib/private/Files/View.php#L257-L258

juliusknorr commented 2 weeks ago

Can confirm that the database mtime is 1724937673 (august 29th) while the last steps that text has persisted are from 1731492067 (today).

Storage has the correct mtime:

-rw-r--r-- 1 www-data www-data 6.3K Nov 13 10:01 XXXXXXX.md

juliusknorr commented 2 weeks ago

Also found in the logs:

"fixing cached size of file id=8165128"
"fixing cached size of file id=8165128"
"fixing cached size of file id=8165128"
"fixing cached size of file id=8165128"
"fixing cached size of file id=8165128"
"fixing cached size of file id=8165128"

-> Apparently that did not work seeing the filesystem and filecache side.

Output from occ file:info 8165128

  fileid: 8165128
  mimetype: text/markdown
  modified: August 29, 2024, 1:21:13 PM UTC
  size: 4 KB
  etag: 6734c323a5789