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 547350 - Sort order problem in Nautilus
Sort order problem in Nautilus
Status: RESOLVED DUPLICATE of bug 458707
Product: nautilus
Classification: Core
Component: general
2.22.x
Other All
: Normal enhancement
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2008-08-11 21:18 UTC by Boris Striker
Modified: 2010-07-14 20:38 UTC
See Also:
GNOME target: ---
GNOME version: 2.21/2.22



Description Boris Striker 2008-08-11 21:18:53 UTC
Please describe the problem:
Nautilus way of sorting is differs from system collating rules:
1) The '#' symbol is always at the end of list.
2) The numbers are always at the begin of list. I can change my locale so what '!' symbol will preceed '0'. In this case 'ls' command will show (the base example below):
  .
  ..
  !ccc
  06ddd
  4zzz
  #aaa
  bbb
But Nautilus will show:
  4zzz
  06ddd
  !ccc
  bbb
  #aaa
3) Is there a way to disable 'intelligent' sort of numbers in file/directory names? I need to see '06ddd' before '4zzz'.

Steps to reproduce:
$ mkdir Test
$ cd Test
$ mkdir 06ddd 4zzz bbb \#aaa \!ccc
$ ls -la
  .
  ..
  06ddd
  4zzz
  #aaa
  bbb
  !ccc

Actual results:
Nautilus lists the directories in the next order (sort by name):
4zzz
06ddd
bbb
!ccc
#aaa

Expected results:
I need to get the list in the same order in Nautilus and with 'ls' command

Does this happen every time?
Yes

Other information:
Changing of locale to get symbols like '!' before numbers (Ubuntu 8.04, may be not for all locales):
$ sudo vim /usr/share/i18n/locales/??_??

Add next lines just before the first 'reorder-after':
collating-symbol <SYM-EXCLM>
collating-symbol <SYM-SHARP>
collating-symbol <SYM-MONEY>
collating-symbol <SYM-PERC>
collating-symbol <SYM-AND>
collating-symbol <SYM-RBRL>
collating-symbol <SYM-RBRR>
collating-symbol <SYM-COMMA>
collating-symbol <SYM-SEMIC>
collating-symbol <SYM-AT>
collating-symbol <SYM-SBRL>
collating-symbol <SYM-SBRR>
collating-symbol <SYM-XOR>
collating-symbol <SYM-UNDER>
collating-symbol <SYM-BAP>
collating-symbol <SYM-FBRL>
collating-symbol <SYM-FBRR>
collating-symbol <SYM-TILDE>
collating-symbol <SYM-PLUS>
collating-symbol <SYM-EQUAL>

Add next lines just before 'reorder-end'
reorder-after <DTT>
<SYM-EXCLM>
<SYM-SHARP>
<SYM-MONEY>
<SYM-PERC>
<SYM-AND>
<SYM-RBRL>
<SYM-RBRR>
<SYM-COMMA>
<SYM-SEMIC>
<SYM-AT>
<SYM-SBRL>
<SYM-SBRR>
<SYM-XOR>
<SYM-UNDER>
<SYM-BAP>
<SYM-FBRL>
<SYM-FBRR>
<SYM-TILDE>
<SYM-PLUS>
<SYM-EQUAL>
% After NBSP
reorder-after <U00A0>
% !
<U0021> <SYM-EXCLM>;<BAS>;IGNORE;IGNORE
% #
<U0023> <SYM-SHARP>;<BAS>;IGNORE;IGNORE
% $
<U0024> <SYM-MONEY>;<BAS>;IGNORE;IGNORE
% %
<U0025> <SYM-PERC>;<BAS>;IGNORE;IGNORE
% &
<U0026> <SYM-AND>;<BAS>;IGNORE;IGNORE
% (
<U0028> <SYM-RBRL>;<BAS>;IGNORE;IGNORE
% )
<U0029> <SYM-RBRR>;<BAS>;IGNORE;IGNORE
% ,
<U002C> <SYM-COMMA>;<BAS>;IGNORE;IGNORE
% .
%<U002E> <SYM-DOT>;<BAS>;IGNORE;IGNORE
% ;
<U003B> <SYM-SEMIC>;<BAS>;IGNORE;IGNORE
% @
<U0040> <SYM-AT>;<BAS>;IGNORE;IGNORE
% [
<U005B> <SYM-SBRL>;<BAS>;IGNORE;IGNORE
% ]
<U005D> <SYM-SBRR>;<BAS>;IGNORE;IGNORE
% ^
<U005E> <SYM-XOR>;<BAS>;IGNORE;IGNORE
% _
<U005F> <SYM-UNDER>;<BAS>;IGNORE;IGNORE
% `
<U0060> <SYM-BAP>;<BAS>;IGNORE;IGNORE
% {
<U007B> <SYM-FBRL>;<BAS>;IGNORE;IGNORE
% }
<U007D> <SYM-FBRR>;<BAS>;IGNORE;IGNORE
% ~
<U007E> <SYM-TILDE>;<BAS>;IGNORE;IGNORE
% +
<U002B> <SYM-PLUS>;<BAS>;IGNORE;IGNORE
% =
<U003D> <SYM-EQUAL>;<BAS>;IGNORE;IGNORE

Close the file and execute:
sudo dpkg-reconfigure locales

Restart GNOME (not needed for 'ls'):
sudo /etc/init.d/gdm restart
Comment 1 Sergio Infante Montero 2008-08-17 06:48:29 UTC
Thanks for taking the time to report this bug.
Unfortunately, that stack trace is missing some elements that will help a lot to solve the problem, so it will be hard for the developers to fix that crash. Can you get us a stack trace with debugging symbols? Please see http://live.gnome.org/GettingTraces for more information on how to do so and reopen this bug or report a new one. Thanks in advance!
Comment 2 André Klapper 2008-08-17 13:23:27 UTC
Sergio: That comment was unappropriate. There is no crash at all.
Hence reopening.
Comment 3 Nelson Benitez 2008-10-01 11:24:13 UTC
Hi, nautilus uses g_utf8_collate_key_for_filename()[1] glib function to sort by
name, that function was implemented in purpose in bug 172690 , if you think it
needs some tweaking then file a bug against glib product.

[1] http://library.gnome.org/devel/glib/2.8/glib-Unicode-Manipulation.html#id3123125
Comment 4 Boris Striker 2008-10-03 20:29:08 UTC
Nelson: Thank you for your reply. I understand, it's not a bug, it's a feature. :) Report status changed to 'enhancement'.
Nautilus calls g_utf8_collate_key_for_filename() function, which is intentionally ignores system collating rules. No, I don't think that there is a bug in the function. I think Nautilus should give to a user at least an option to use a classic sort order.
I was googled a lot before post a report here. I found many people use alternative file managers because of points described in this report. Seems, I'll be one of them. :(
P.S.: Sorry for my english
Comment 5 Cosimo Cecchi 2009-04-19 18:24:33 UTC
Thanks for the bug report. This particular bug has already been reported into our bug tracking system, but please feel free to report any further bugs you find.


*** This bug has been marked as a duplicate of 458707 ***
Comment 6 Christopher 2010-07-14 20:38:31 UTC
Looking at the code, I can see that the g_utf8_collate_key_for_filename() function is only responsible for sorting numbers before everything else, but Nautilus goes out of its way to specifically put the symbols '.' and '#' at the end of the list.
Special handling for the dot kinda makes sense (though i don't see why g_utf8_collate_key_for_filename doesn't take care of that), but why '#'?