After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 458707 - Sort order ignores special characters
Sort order ignores special characters
Status: RESOLVED NOTABUG
Product: nautilus
Classification: Core
Component: general
2.18.x
Other All
: Normal normal
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
: 547350 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2007-07-20 16:45 UTC by DavidCognito
Modified: 2010-10-19 21:17 UTC
See Also:
GNOME target: ---
GNOME version: 2.17/2.18


Attachments
Showing the expected behaviour (179.94 KB, image/png)
2008-10-29 17:27 UTC, Robert Leverington
Details

Description DavidCognito 2007-07-20 16:45:49 UTC
Please describe the problem:
File / folder sorting in Nautilus ignores special characters ('_', '!', '~', etc.) and therefore does not obey ASCII sort order (http://www.ddms.com/resources/help/reportsmenu/ASCII_Sort_Order_Chart.htm).

Steps to reproduce:
1. create three files: 'aaa', '_bbb' and '!ccc'

Actual results:
They are ordered as follows:
aaa
_bbb
!ccc

Expected results:
They should be ordered:
!ccc
_bbb
aaa

Does this happen every time?
Yes

Other information:
Thunar (http://thunar.xfce.org/) gets it right.
Comment 1 André Klapper 2007-09-05 20:10:28 UTC
google is your friend:
http://www.mail-archive.com/nautilus-list@gnome.org/msg03778.html
Comment 2 DavidCognito 2007-09-05 20:56:32 UTC
That link does not offer a fix for this bug.
Comment 3 Jürg Billeter 2007-09-05 21:08:28 UTC
nautilus uses the collation rules of your locale, that's not a bug. If you don't like your locale, change it.

BTW: ls behaves the same

With my default locale (de_CH.UTF_8):
$ ls
aaa  _bbb  !ccc

With the C locale:
$ LC_ALL=C ls
!ccc  _bbb  aaa
Comment 4 DavidCognito 2007-09-05 21:26:01 UTC
OK, I misunderstood.  Apologies.

So, I can change this behaviour with locale, but this still remains a bug AFAIC.  Sort order should follow some rule - ASCII for most of us?

I'm new to Linux and was surprised to see, what seems to me, such a basic bug ... which causes me lots of problems migrating from Windows due to how I have named files and folders.
Comment 5 Alexander Larsson 2007-09-06 07:11:04 UTC
Not a bug. File sort follows the collation rules of the locale. If you are amongs the minority of people on the planet that thinks "ascii order" is the "right" order, you can use the "C" locale (for all or just LC_COLLATE).
Comment 6 DavidCognito 2007-09-06 09:59:58 UTC
It would appear Windows Explorer follows ASCII sort order (or something close to it). How many people use a version of Windows? 90%+?  Hardly a "minority of people on the planet".  There's more to the planet than your little corner.

Does Nautilus follow any sort standard?  Or was some arbitrary method chosen?  Why are leading characters just ignored?  Is it a case of "That's the way we did it, if you don't like it, change it yourself" .  That's not very helpful or friendly for those trying to adopt Linux.

It appears to be a bug (for anyone migrating from Windows) and I'm not the only one - http://ubuntuforums.org/showthread.php?p=3316176.
Comment 7 Jürg Billeter 2007-09-06 10:42:06 UTC
90% of the people use Windows Explorer, so it does the right thing? If you reason like that, everything in Windows is the right thing...

The sort order is not defined by Nautilus, it's defined by the underlying locale the user has chosen, i.e. it is language/country dependant. I don't know how the collation order for the locales in glibc has been chosen, maybe there are rules set by the Unicode standard?
Comment 8 DavidCognito 2007-09-06 12:05:57 UTC
Straw man. 

I clearly never suggested that "if Windows does it, it's the right thing".  You need to work on your reasoning and argument skills.

I responded to the obviously false claim that "a minority of the planet think 'ASCII' sorting is the right method".

I must say, this exchange has really conformed to the stereotype of the pedantic, unfriendly, elitist, closed-rank geek.  My intention was to report a 'bug' that will appear as a bug to the thousands of Windows users migrating to Linux.  I thought maybe it would be an issue for those trying to make Nautilus a better application.  Now it seems like "You can do it our way or fuck off".

I'll know better next time than to try and get involved.
Comment 9 Jürg Billeter 2007-09-06 12:33:59 UTC
I'm sorry if my comment sounded too harsh, it wasn't meant that way; I'm not a native speaker and may not always use the word that fits best. However you directly concluded from the fact that 90% of the people use Windows Explorer, that 90% of the people think that ASCII sorting is the right method, and that's the conclusion I disagree with.

The point is that you will hear many different opinions about the "best" sort order and that should be a system-wide locale setting, not just a choice of Nautilus. Assuming that nautilus follows LC_COLLATE, it's not a bug in Nautilus but possibly in your locale. Open a bug in your distro to talk about a possible change in the locales resp. the reasons why it currently uses that sort order.
Comment 10 Alex Guzu 2008-08-04 23:40:28 UTC
The problem is not only with special characters. The Sorting is also case-sensitive in a very BAD way. Lower-case characters are after all upper-case characters.

For example:

consider the files: A, B, C, aa, bb, cc,

They are sorted like this:

A
B
C
aa
bb
cc

When they should be sorted:
A
aa
B
bb
C
cc

or something like this.
Comment 11 Robert Leverington 2008-10-29 17:27:57 UTC
Created attachment 121593 [details]
Showing the expected behaviour

I have tried the suggested fix of using LC_COLLATE=C in .gnomerc (and restarting) to change the sort order, but this has not worked.  The attached screen shot shows that I have the correct locale set, that Nautilus is not ordering correctly, and how I expected it to order given the suggested workaround.  Any further assistance or advice would be greatly appreciated.
Comment 12 Cosimo Cecchi 2009-04-19 18:24:33 UTC
*** Bug 547350 has been marked as a duplicate of this bug. ***
Comment 13 Boris Striker 2009-04-25 10:23:21 UTC
Jürg Billeter:
> nautilus uses the collation rules of your locale, that's not a bug. If you
> don't like your locale, change it.

Alexander Larsson:
> Not a bug. File sort follows the collation rules of the locale. If you are
> amongs the minority of people on the planet that thinks "ascii order" is the
> "right" order, you can use the "C" locale (for all or just LC_COLLATE).

Nautilus DOES NOT always use the system collation rules. That's the problem.
Numbers are always first in naulitus panel, '#' is always last. Change of collation rules makes no difference. For more information, please, see Bug 547350.

So, I think it's a bug.
Comment 14 Jason M. Sullivan 2009-12-30 16:10:49 UTC
I'm not sure why this has been closed here.  It looks like Nautilus is picking up _some_ but not _all_ aspects of the sort order defined by setting LC_COLLATE=C.  For example, setting LC_COLLATE=C makes sorting of upper vs. lower case letter follow ASCII coding order.  However, a directory full of files named for hex numbers, like this:

jason@krazykat:~/testDir$ ls -l
total 0
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 00125413
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 01090f13
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 010cde10
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 02041301
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 0204a001
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 02063e01
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 02113f10
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 0212aa01
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 03128313
-rw-r--r-- 1 jason jason 0 2009-12-30 10:27 050c270f

Instead gets sorted like this in nautilus...

010cde10
050c270f
0204a001
0212aa01
01090f13
02063e01
02113f10
00125413
02041301
03128313

...which doesn't follow ASCII coding order.  So, is this my imperfect understanding of what LC_COLLATE=C means (although 'ls' seems to do the ASCII order), or is this just an alternate understanding of LC_COLLATE=C by Nautilus (which is what I assume "NOTABUG" implies).
Comment 15 Tom 2010-05-26 00:33:11 UTC
Look,

3aa
4aa
20a

Is just BROKEN.
Comment 16 Boris Striker 2010-06-10 06:04:34 UTC
> 3aa
> 4aa
> 20a

Is not broken because 3 < 4 < 20. But why the developers don't want to give us an option to use normal sort order - that's the question...
Comment 17 Tom 2010-06-10 13:00:39 UTC
Isn't it broken to assume "BASE 10 numeric"?

* In "BASE 16 numeric" (which is what these REALLY ARE!) 20a < 3aa < 4aa

* In ASCII normal like _1960 FREAKING "ls -l"_ 20a < 3aa < 4aa

Do I gotta use "konqueror" or "pcmanfm"?

What can I use instead of "geeqie" now that "gqview" broke"?

It is telling that you call it "normal" sort order...

And the phrase "why the DEVELOPERS don't want to give US an option..."

So, help me understand... What is the governance process for this project?
Comment 18 Boris Striker 2010-06-10 19:09:50 UTC
> Isn't it broken to assume "BASE 10 numeric"?
I only tried to explain developers' position. As for me, I prefer 20a < 3aa < 4aa.

> In "BASE 16 numeric" (which is what these REALLY ARE!)
Does it mean that you would like to see even more artifical intelligence sort function in Nautilus, which could be able to guess where are decimal numbers and where are hex?

> It is telling that you call it "normal" sort order
My bad, sorry. I meant system collation rules. That was discussed above. The rules are not ASCII, you can affect the rules like this way: https://bugzilla.gnome.org/show_bug.cgi?id=547350
You can control 'ls -l' output this way, but you can't control Nautilus... At least I don't know how.

> And the phrase "why the DEVELOPERS don't want to give US an option..."
I'm clearly realize, the developers have no duty to implement users wishes. But this report got 'not a bug' status. If one would manage to make a patch one day, will the developers accept the patch if there is no bug?
Comment 19 Tom 2010-06-10 20:40:12 UTC
Nevermind ... I thought this was 355152 ... which is open still...
Comment 20 Sven Witterstein 2010-07-19 10:38:35 UTC
I have now read tons and tons of pro and con of it.
Just my 2 cents:

Cheap, general solution:
- Make an option available in Gconf to change between "ascii" "natural" (=the current with respect to numbers that are NOT prefixed with "0" ) and "dos/win-Style" ( prefixes with . in front of the rest, folders separated")

Better solution:
- offer a per-directory config option in addition.
Reason: on my "linux" files, I can live perfectly happy with "natural" sort order though it "feels" sometimes "weird" and "buggy" - but I do have to mount a lot of stuff created under windumb - so "win-style" Order should be default for ntfs-partitions and be selectable for all those dirs from my co-workers that have all the "!" "__" "_" etc. prefixing to put important stuff, such as "_main.cpp" on top of a source dir.

It would be so nice to find a solution that offers - thoug hidden in gconf - choice over the flame war going on here...

Please change status back to "Enhancement"!
Comment 21 Olivier Cailloux 2010-10-19 19:31:57 UTC
Apologies if I'm wrong but it seems to me that a few errors appear in the answers to this bug report, e.g. "BTW: ls behaves the same" in comment #3. IMHO it should be re-opened, though I don't know if it should be considered a "bug" or a "feature" or even if it belongs to Nautilus rather than some other package (but then which one?).

Please see my detailed tries on http://ubuntuforums.org/showthread.php?t=1588316 .

Thanks.
Comment 22 Tom 2010-10-19 19:53:26 UTC
Well, I think someone thought it was a "feature" to make "numeric" stuff work better:
3aa.txt
4aa.txt
20a.txt
assuming that they were "numbered" as 3,4,20.

Of course, if they are 3-digit numbers in base 16, you're screwed.

And, apparently, they didn't think the ability for Gnome to sort like, say, "ls" has FOREVER might matter to anyone... When they added this "feature"...

And, as far as I know, there is no option to turn on or off this "feature"...
Comment 23 Tom 2010-10-19 19:54:23 UTC
But ... again ... see 355152
Comment 24 Olivier Cailloux 2010-10-19 21:17:35 UTC
Ok, I forgot https://bugzilla.gnome.org/show_bug.cgi?id=355152 .

Then this bug should be marked as a duplicate of 355152 instead of invalid.