id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	blockedby	blocking	branch_state	votes
3715	Midnight Commander 4.8.17/4.8.18 - strange behaviour on sorting file-/folder lists (race condition?)	ak	andrew_b	"Since mc 4.8.17 using the mouse to sort files via double clicking on the fields ""n"", ""name"", ""size"" ""modify time"" at the top of the panels, behaves rather strangely.

Now I know that the term ""double clicking"" might sound a bit strange, actually I quite often want to see files/folders sorted by modification date in descending order (most recent ones at the top), so it takes clicking twice to achieve that.

If you double-click rather quickly (or better, if you don't wait between the clicks for some time), the file/folder list gets sorted and directly after that mc ""jumps"" into the sub folder which was marked at that time or one step up in the tree (just do this quick sorting by double clicking on ""modify time"" twice and you will see what I mean).

If you wait about 1-2 seconds between those clicks for sorting the view, the normal behaviour can be observed.

I checked versions 4.8.16 - 4.8.18 and 4.8.16 is the last version not to be affected.

I know this might be a little hard to understand (it is quite difficult to explain also, so please bear with me), so I will give you an example:

1) mc shows the root of the directory tree on a linux system, so I see the sub folders /bin,  /boot, /dev, /etc and so on

2) let's say the folder ""/home"" is in focus (so the coloured bar of mc showing which file/folder could be marked with ""insert"" is over ""/home"")

3) now quickly (= normal speed you would use to do a double click anywhere else) double click on ""modify time"" or any other sorting criteria offered at the top of of the panel to sort according to that criteria.

4) you will see mc do the sorting twice (first ascending then descending) and immediately after that it will ""jump"" to the /home directory

5) repeat the same double click again in /home where you just landed, and after sorting the sub folders in /home mc will again jump immediately but this time you will go one up in hierarchy and you will be back in the root of the directory tree.

6) repeat the same ""maneuver"" again but now wait 1-2 seconds between clicking on ""modify time"" and mc behaves well in that way (most of the time at least).

One interesting note (and a second hint to why I think there might be a race condition here) if the object in focus is a file and not a folder this strange behaviour does not seem to appear.

What do I mean by this?

7) let's say again we are in the root of the directory tree and there is a file under focus (just create one by ""touch /test_file"" and select that file via cursor or with your mouse)

8) now you can click on all sorting criteria as fast as you can, mc will behave as expected (as there is no folder in focus it could otherwise change into?)

I hope my explanation is somehow understandable.

Greetings,

AK"	defect	closed	critical	4.8.19	mc-core	4.8.17	fixed		egmont			merged	committed-master
