Synchronize Dirs - results sometimes missed

The behaviour described in the bug report is either by design, or would be far too complex/time-consuming to be changed

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Synchronize Dirs - results sometimes missed

Post by *MarcinW »

Test 1:
1) create file c:\test1\file.txt in left panel (empty)
2) create file c:\test2\file.txt in left panel (with any non-empty contents)
3) ensure that dates/times of both files are different
4) launch "Commands -> Synchronize Dirs"
5) make "by content" and "ignore date" options ENABLED
6) press "Compare" button
7) the result shows, that both files are different ("<=>" column shows "=/=")
8) right-click line with the result and click "Copy file properties ->" or "Copy file properties <-" option
9) select "Timestamp (date+time)" and press OK
10) the result still shows, that both files are different ("<=>" column shows "=/=")

Both files are still same, and the result is still same - this is OK.


Test 2:
1) AS ABOVE
2) copy this file to c:\test2\file.txt in right panel
3) modify date/time of one of these files (by using "Files -> Change Attrbutes")
4) AS ABOVE
5) AS ABOVE
6) AS ABOVE
7) the result shows, that both files are same ("<=>" column shows "=")
8) AS ABOVE
9) AS ABOVE
10) the result now is shown as unknown ("<=>" column shows "?")

Both files are still same, but the result changed to "unknown".


The fix seems to be quite simple:
- if "by content" option is ENABLED and files are different => they should remain different after synchronizing the attributes (this is already implemented)
- if "by content" option is ENABLED and files are same => they should remain same after synchronizing the attributes

Regards
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

TC does this because when the time changes, it's possible that the content has changed too. TC cannot assume that the content was unchanged, but cannot assume that it was changed either, so it shows a "'?".
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Ok, this makes sense.

However, this can be still distinguished, because:
- the time has been changed due to the user-initiated action (i.e. date/time sync request)
AND
- the time that was set is NOT the current time.

When file time is changed to some value that is older than the time when the user clicked sync menu, TC could safely assume that time change was NOT due to any background operation - so still "=" could be displayed.

Regards
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Actually you changed it via:
modify date/time of one of these files (by using "Files -> Change Attrbutes")
You can use "Current time" there. Then TC cannot know why the time changed.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

In theory - yes, it can be non-distinguishable.

In real life no - it's not really possible to set file's date/time and - within the same second - launch Synchronize Dirs tool, perform search, right-click the result and select date/time synchronization option from there :)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

But you can edit a file outside of the tool and save it. This would give it the same size but different timestamp if you just replace characters, e.g. from lowercase to uppercase.
Author of Total Commander
https://www.ghisler.com
User avatar
MarcinW
Power Member
Power Member
Posts: 852
Joined: 2012-01-23, 15:58 UTC
Location: Poland

Post by *MarcinW »

Ok, you are right.

So maybe this:
A) remember the time of pressing "Compare" button
B) after synchronizing date/time:
- if the new date/time is older than the moment of pressing "Compare" button -> still display "="
- if the new date/time is equal or newer than the moment of pressing "Compare" button -> display "?"

Regards
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Sorry, I prefer to keep it as it is now.
Author of Total Commander
https://www.ghisler.com
Post Reply