Bug 237788 - Dolphin can't decide how to sort some files; changes its mind
Summary: Dolphin can't decide how to sort some files; changes its mind
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: general (show other bugs)
Version: 16.12.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-16 07:05 UTC by Brendon Higgins
Modified: 2010-10-22 14:31 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.5.3
Sentry Crash Report:


Attachments
screencast showing "jumpy" sorting in dolphin (220.38 KB, video/ogg)
2010-05-25 11:12 UTC, Benjamin Schmitz
Details
screenshot showing erratic sort order in dolphin (35.06 KB, image/png)
2010-05-25 11:21 UTC, Benjamin Schmitz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Brendon Higgins 2010-05-16 07:05:05 UTC
Version:           1.4 (using 4.4.3 (KDE 4.4.3), Debian packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.32-3-amd64

Create two files like so: "touch test_1test.pdf test_a_test.pdf". View the folder in dolphin. Move the cursor over the second of the two files, then move it away. The order of the files will suddenly swap. Keep doing this and they'll keep swapping.

What's weird is that only certain file extensions seem to trigger this, at least with these test filenames. pdf and ps extensions do, while txt, x, a, aa, and gif don't. They're just the ones I tried. I noticed the ones that don't do it don't generate thumbnails, so I wonder if the thumbnailer is involved in some subtle way.
Comment 1 Frank Reininghaus 2010-05-16 17:30:03 UTC
Thanks for the bug report! Probably related to 237621/bug 217048.
Comment 2 Benjamin Schmitz 2010-05-25 11:04:40 UTC
I have the same problem: when files are named in a specific way (I haven't figured out yet, what exactly is the cause) they jump around when you mouse-over them.

If you disable thumbnail previews, files do not jump around anymore when hovered. However, they will be sorted in wrong order.

If you turn off "Natural sorting of items" the problems vanish.
Comment 3 Benjamin Schmitz 2010-05-25 11:12:16 UTC
Created attachment 43869 [details]
screencast showing "jumpy" sorting in dolphin

This screencast shows items in a folder change place when you hover them. It happens when previews and natural sort order are enabled.
Comment 4 Benjamin Schmitz 2010-05-25 11:19:04 UTC
Another example screencast, showing a folder of images in icon preview mode:

http://www.mediafire.com/?ykykowbgwmd
Comment 5 Benjamin Schmitz 2010-05-25 11:21:10 UTC
Created attachment 43870 [details]
screenshot showing erratic sort order in dolphin

This shows the folder from the last example with previews turned off.

Files do not change places anymore when hovered, but they are sorted in wrong order.
Comment 6 Peter Penz 2010-05-25 11:39:07 UTC
This is a duplicate of bug 217048 and solved already (it has been backported to KDE SC 4.4.4).

*** This bug has been marked as a duplicate of bug 217048 ***
Comment 7 Peter Penz 2010-05-25 11:40:18 UTC
@Benjamin: Thanks for the screenshots! Although in this case the issue was resolved already, usually this helps us a lot.
Comment 8 Janet 2010-09-24 22:36:20 UTC
Problem still exists in KDE SC 4.5.1.
Comment 9 Peter Penz 2010-09-27 16:04:31 UTC
@Janet: I cannot reproduce this issue with 4.5.1
Comment 10 Janet 2010-10-09 19:12:23 UTC
I can reproduce it in KDE 4.5.1, just was about to file a bug report about the issue, there are several things that must match:

1. natural sorting must be enabled!
2. previews must be enabled!
3. you need at least three files that start with the same letters in the name
4. at least one of the files has an underscore right after those same letters, one has a number (not zero!) after those letters and one has the file ending right after those letters, e.g. abc_a.jpg, abc.jpg and abc1.jpg - three files are the minimum for the show.

It can take up some seconds before the files begin to switch positions. Usually hovering and staying over the last of the three files for a while starts the process.

I also have brought abc.txt, abc_a.txt and abc1.txt to "dance", but only once. It doesn't happen always, it is way easier to demonstrate it with pictures, they tend to dance more than text files, guess it has to do something with the thumbnail. So try using photos and rename them accordingly.
Comment 11 Frank Reininghaus 2010-10-20 18:13:49 UTC
Thanks Janet for the detailed instructions. I could reproduce the issue in trunk.
Comment 12 Peter Penz 2010-10-21 17:55:44 UTC
SVN commit 1188178 by ppenz:

Revert the patch to handle ' ', '.' and '_' equally, as this violates the rule: if a < b and b < c, a must also be < c. The issue can be reproduced with the strings abc.jpg, abc1.jpg and abc_a.jpg. I really propose to make this "natural sorting" not more clever than necessary, just handling digits in a "natural" way is sufficient from my point of view.

BUG: 237788
FIXED-IN: 4.5.3



 M  +8 -8      tests/kstringhandlertest.cpp  
 M  +5 -8      text/kstringhandler.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1188178
Comment 13 Peter Penz 2010-10-21 17:56:07 UTC
SVN commit 1188180 by ppenz:

Forward port: Revert the patch to handle ' ', '.' and '_' equally, as this violates the rule: if a < b and b < c, a must also be < c. The issue can be reproduced with the strings abc.jpg, abc1.jpg and abc_a.jpg. I really propose to make this "natural sorting" not more clever than necessary, just handling digits in a "natural" way is sufficient from my point of view.

CCBUG: 237788



 M  +8 -8      tests/kstringhandlertest.cpp  
 M  +5 -8      text/kstringhandler.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1188180
Comment 14 Peter Penz 2010-10-21 18:01:30 UTC
Thanks Janet, Benjamin and Brendon for the good descriptions, I could reproduce the issue now and have applied a fix. I've reverted a patch that was written to improve the natural sorting (e. g. "Episode 24" should be smaller than "Episode_25"), however this resulted in unpredictable orders. I'll take care in future to not accept such kind of patches for natural sorting and just define "natural sorting" as handling digits in a special way. I've added this bug as part of the unit-tests to detect possible regressions in future.
Comment 15 Janet 2010-10-22 14:05:17 UTC
Explains a lot. No signs should be treated equal, this always will lead to problems in sorting. I fully agree, natural sorting should only concern digits, no other signs. Thanks a LOT for reverting this!

What I don't understand: why did this only happen when previews are turned on?
Comment 16 Peter Penz 2010-10-22 14:31:46 UTC
> What I don't understand: why did this only happen when previews are turned on?

When previews are turned on, the items are updated asynchronously and trigger a different comparison order (it just compares the items that require an update). As it was not assured that if a<b and b<c that also a<c, this resulted in this "jumping". I guess that with your example even without previews the order of the items was non-deterministic, but at least no jumping happened. But I'm glad that this is solved now :-)