Inconsistent sorting by date

Here you can report bugs found in Far Manager.
Post Reply
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Inconsistent sorting by date

Post by pepak »

It seems there is an error in FAR's sorting panels by date:

1) I downloaded 4 files in quick sequence using WGET.
2) I got the following Last Change Dates for them (sorted by filename, time only because the date part is the same for all of them):

Code: Select all

a = 12:58:29,5636335
b = 12:58:29,3007902
c = 12:58:29,1787716
d = 12:58:29,9174535
3) Sort by date descending (CTRL+F5, shown as "W" in FAR) is correct:

Code: Select all

d
a
b
c
4) Sort by date ascending (CTRL+F5 again, shown as "w" in FAR) is not correct (should be the reverse of #3):

Code: Select all

a
b
c
d
I am getting that result with a clean version (= no plugins, new profile) of FAR3 build 5730, both 32-bit and 64-bit.
User avatar
HaRT
Moderator
Posts: 10855
Joined: Tue 30 Aug, 2005 17:21
Has thanked: 221 times
Been thanked: 358 times

Inconsistent sorting by date

Post by HaRT »

I don't see this in version 3.0.5718.0 x86 — in the w mode, the files are ordered c, b, a, d, as expected.
Фар есть инструмент, а не нянька. © 2009 DrKnS
Shmuel
Posts: 6834
Joined: Thu 23 Mar, 2006 21:36
Location: Israel
Has thanked: 41 times
Been thanked: 530 times

Inconsistent sorting by date

Post by Shmuel »

What's "Last change Dates" ? There are "Last write time" and "Change time".
CtrlF5 sorts by "Last write time".
I suspect that your time stamps are "Change times". If that is the case then the results of CtrlF5 don't depend on these values.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Inconsistent sorting by date

Post by pepak »

Well, it's not really the problem of which field gets used but that the ascending order does not give a reverse of the descending order.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Inconsistent sorting by date

Post by pepak »

And I think we have a solution. Upon more detailed checking, it turns out that apparently wget sets the Last Write Time to whatever the server reports as the change time, with a precision of seconds. As a result, files a, b and c have the same time and d has +1 second. Which would explain the differences in ascending/descending - files a-c are "the same" and that means that the secondary criterion of a filename will be used to sort them. However, that is rather contraintuitive - if I switch from Ascending to Desccending, I would expect to get a true reverse, not a partial one. It might make sense to use an additional criteria here, e.g. the creation time or change time, or even apply reverse to *all* sorting criteria, not just the latest one.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Inconsistent sorting by date

Post by DrKnS »

As already mentioned, "change time" is not related to Ctrl+F5 in any way.
If "last write time" of a set of files is rounded for whatever reason, they will obviously be considered equivalent and the fallback criterion will be used (by name).
You can change the fallback criterion and its direction via F4 in the sort modes menu.
pepak
Posts: 604
Joined: Sun 13 Jul, 2008 11:18
Has thanked: 17 times
Been thanked: 54 times

Inconsistent sorting by date

Post by pepak »

DrKnS wrote: Mon 18 Jan, 2021 18:43You can change the fallback criterion and its direction via F4 in the sort modes menu.
The point is, whatever criteria and backup criteria I have, I think that if I am at "A, B" and then ask for a reverse order, "rev A, rev B" should be used. FAR uses "rev A, B". I can see the reason for FAR's choice, but it leads to confusing ordering because a sequence "a, b, c" is expected to turn into "c, b, a", but that's not necessarily true if the primary criterion is equal for two files.
User avatar
DrKnS
Posts: 6114
Joined: Thu 04 Aug, 2005 06:44
Location: Kyiv
Has thanked: 12 times
Been thanked: 426 times

Inconsistent sorting by date

Post by DrKnS »

There's a reason indeed - Far is not a pure abstract sorting machine for proving math theories. It's a file manager for laypeople. The whole point of sorting here is finding specific files, and the whole point of fallback criteria is helping you to find that specific file unambiguously when the primary criterion is ambiguous.

If you're looking for an ancient file, you sort by date in ascending order. If there are multiple files with the same timestamp, you want them to be arranged alphabetically in ascending order, from A to Z, not because the date order is ascending as well, but because it's the most obvious way to do it and it helps to pinpoint the file you're looking for.

If you're looking for a recent file, you sort by date in descending order. If there are multiple files with the same timestamp, you still want them to be arranged alphabetically in ascending order, from A to Z, because t's still the most obvious way to do it and it still helps to pinpoint the file you're looking for. Flipping the fallback criterion here won't be helpful and would only confuse people.

However, as I said earlier, it's all configurable. Fallback orders can follow the primary if that's what you want.
Post Reply

Return to “Bug Reports”