Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect mtime displayed for unchanged files/dirs in some cases #1112

Open
tleedjarv opened this issue Jan 18, 2025 · 0 comments
Open

Incorrect mtime displayed for unchanged files/dirs in some cases #1112

tleedjarv opened this issue Jan 18, 2025 · 0 comments
Labels
defect unison fails to meet its specification (but doesn't crash; see also "crash") effort-high issue is likely to require >20h of effort, perhaps much more impact-low low importance wontfix maintainers choose not to work on this, but PR would still be considered

Comments

@tleedjarv
Copy link
Contributor

First, this is not a syncing issue.

Consider the following scenario:

$ echo test1 > testa
... wait for a while to make the difference in mtimes more obvious ...
$ echo test1 > testb
$ unison -times=false testa testb
Nothing to do: replicas have been changed only in identical ways since last sync.

$ stat testa testb
  File: testa
Modify: 2025-01-18 10:43:28
  File: testb
Modify: 2025-01-18 10:43:44
$ echo test2 > testa
$ stat testa testb
  File: testa
Modify: 2025-01-18 10:44:35
  File: testb
Modify: 2025-01-18 10:43:44

$ unison -times=false testa testb
testa          testb              
changed  ---->              [f] x
testa        : changed file       modified on 2025-01-18 at 10:44:35  size 6         rw-r--r--
testb        : unchanged file     modified on 2025-01-18 at 10:43:28  size 6         rw-r--r--

Notice how for the unchanged file testb an incorrect modification time is displayed. Looking closer, the time displayed is the previous mtime of the modified file testa.

This happens for files when the times preference is off. This happens for directories regardless of the times preference value because dir mtimes are not synced (effectively behaving as if times=false).

The cause

When updates are scanned, all unchanged files and dirs are simply reported as unchanged, without any additional information. Changed files and dirs (regardless of the nature of the change) are reported with the details of the change together with the previously synced details as stored in the archive.

During reconciliation, the data of previous details from the changed side are also used for the unchanged file/dir to fill in the previous (= current) details of the unchanged file/dir. This is ok because the archives contain synced information so the details are expected to be the same in each archive.

However, there is some data in the archives that is not equal between the archives:

  • mtimes when times=false
  • mtimes for directories regardless of times preference

As far as I can tell, only mtimes are affected currently. In general, any details that are recorded as props in the archive and displayed to the user but not actually synced on disk would be affected. (Note that there is other data in the archives that is not equal between them, yet not displayed to the user, such as inode numbers or status change times; this ticket is not about such data.)

Impact and resolution

Importantly, this is not a syncing issue! This is a display issue only, possibly confusing the user. The main impact is with times=false (which should be considered an exception rather than normal), directory mtimes being less relevant (and possibly should not be displayed at all?).

I am opening this ticket for the record only. As something to consider if props is in future extended with similar non-synced-but-displayed details or when deciding to display inherently non-equal details (such as the aforementioned inode numbers).

Actually fixing this issue is possible, of course, but would in practice mean sending over the entire archive from the remote host to the client and keeping it in memory (which could be hundreds of MB for huge replicas, as discussed recently). This is not feasible at the moment.

@gdt gdt added defect unison fails to meet its specification (but doesn't crash; see also "crash") effort-high issue is likely to require >20h of effort, perhaps much more impact-low low importance wontfix maintainers choose not to work on this, but PR would still be considered labels Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect unison fails to meet its specification (but doesn't crash; see also "crash") effort-high issue is likely to require >20h of effort, perhaps much more impact-low low importance wontfix maintainers choose not to work on this, but PR would still be considered
Projects
None yet
Development

No branches or pull requests

2 participants