[Bug 2154042] Re: ls: files are not sorted in alphabetical order when using --group-directories-first or if LC_ALL is unset

Harm van Bakel 2154042 at bugs.launchpad.net
Sun May 24 16:30:18 UTC 2026


Actually the issue is more complex. The sorting issues also occur if
LC_ALL is unset.

---
For example, rust-ls is giving the following:

LC_ALL= /usr/bin/ls --color=auto -l

drwxrwxr-x   6 harm harm  4096 Feb 15  2025 CytoscapeConfiguration
drwxr-xr-x   2 harm harm  4096 Dec 20 17:45 Desktop
lrwxrwxrwx   1 harm harm    18 Dec 30  2021 Documents -> Private/Documents/
drwxr-xr-x  22 harm harm 12288 May 23 18:25 Downloads
drwx------+  9 harm harm  4096 May 23 06:55 Dropbox
drwxrwxr-x   2 harm harm  4096 Nov 10  2023 Invoices
drwxrwxr-x  62 harm harm  4096 Apr 11 18:14 Jupyter
drwxrwxr-x   2 harm harm  4096 Mar 10  2022 Music
drwxrwxr-x   5 harm harm  4096 Sep  2  2024 OneDrive
drwxr-xr-x   6 harm harm 36864 Oct 27  2024 Pictures
drwx------  16 harm harm  4096 Apr 12 15:18 Private
drwxrwxr-x   3 harm harm  4096 Oct 29  2022 Projects
drwxr-xr-x   2 harm harm  4096 Jul  3  2020 Public
drwxrwxr-x  32 harm harm  4096 May 23 18:14 SynologyDrive
drwxrwxr-x   5 harm harm  4096 Dec  9 07:51 SynologyRibeira
drwxr-xr-x   2 harm harm  4096 Jul  3  2020 Templates
drwxr-xr-x   4 harm harm  4096 Feb  2  2025 Videos
drwxr-xr-x   9 harm harm  4096 Jun 19  2025 analysis
drwxrwxr-x   4 harm harm 20480 May  4 12:44 bin
drwxrwxr-x   2 harm harm  4096 Aug  2  2025 blat
drwxrwxr-x   4 harm harm  4096 May  3 05:33 conda
drwxr-xr-x   3 harm harm  4096 Nov 15  2024 jupyter-metadata-export
drwxrwxr-x   4 harm harm  4096 Feb 13 09:43 manuscript-repositories
drwxrwxr-x  20 harm harm  4096 Apr 12 15:19 miniconda3
drwxr-xr-x 128 harm harm  4096 May  6 19:07 opt
drwxrwxr-x   3 harm harm  4096 Jan 28  2025 pMorpheus
drwxrwxr-x   2 harm harm  4096 Nov 20  2024 recruitment
drwxrwxr-x  15 harm harm  4096 May 11 11:13 reimbursement
drwxrwxr-x   2 harm harm  4096 Sep  5  2024 results
drwx------  29 harm harm  4096 May  9 16:29 snap
drwxrwxr-x   2 harm harm  4096 May  3 05:38 sources
drwxrwxr-x  36 harm harm  4096 Apr 15 18:41 tmp

---
While gnuls gives the following:

LC_ALL= /usr/bin/gnuls --color=auto -l

drwxr-xr-x   9 harm harm  4096 Jun 19  2025 analysis
drwxrwxr-x   4 harm harm 20480 May  4 12:44 bin
drwxrwxr-x   2 harm harm  4096 Aug  2  2025 blat
drwxrwxr-x   4 harm harm  4096 May  3 05:33 conda
drwxrwxr-x   6 harm harm  4096 Feb 15  2025 CytoscapeConfiguration
drwxr-xr-x   2 harm harm  4096 Dec 20 17:45 Desktop
lrwxrwxrwx   1 harm harm    18 Dec 30  2021 Documents -> Private/Documents/
drwxr-xr-x  22 harm harm 12288 May 23 18:25 Downloads
drwx------   9 harm harm  4096 May 23 06:55 Dropbox
drwxrwxr-x   2 harm harm  4096 Nov 10  2023 Invoices
drwxrwxr-x  62 harm harm  4096 Apr 11 18:14 Jupyter
drwxr-xr-x   3 harm harm  4096 Nov 15  2024 jupyter-metadata-export
drwxrwxr-x   4 harm harm  4096 Feb 13 09:43 manuscript-repositories
drwxrwxr-x  20 harm harm  4096 Apr 12 15:19 miniconda3
drwxrwxr-x   2 harm harm  4096 Mar 10  2022 Music
drwxrwxr-x   5 harm harm  4096 Sep  2  2024 OneDrive
drwxr-xr-x 128 harm harm  4096 May  6 19:07 opt
drwxr-xr-x   6 harm harm 36864 Oct 27  2024 Pictures
drwxrwxr-x   3 harm harm  4096 Jan 28  2025 pMorpheus
drwx------  16 harm harm  4096 Apr 12 15:18 Private
drwxrwxr-x   3 harm harm  4096 Oct 29  2022 Projects
drwxr-xr-x   2 harm harm  4096 Jul  3  2020 Public
drwxrwxr-x   2 harm harm  4096 Nov 20  2024 recruitment
drwxrwxr-x  15 harm harm  4096 May 11 11:13 reimbursement
drwxrwxr-x   2 harm harm  4096 Sep  5  2024 results
drwx------  29 harm harm  4096 May  9 16:29 snap
drwxrwxr-x   2 harm harm  4096 May  3 05:38 sources
drwxrwxr-x  32 harm harm  4096 May 23 18:14 SynologyDrive
drwxrwxr-x   5 harm harm  4096 Dec  9 07:51 SynologyRibeira
drwxr-xr-x   2 harm harm  4096 Jul  3  2020 Templates
drwxrwxr-x  36 harm harm  4096 Apr 15 18:41 tmp
drwxr-xr-x   4 harm harm  4096 Feb  2  2025 Videos


** Summary changed:

- ls: files are not sorted in alphabetical order when using --group-directories-first
+ ls: files are not sorted in alphabetical order when using --group-directories-first or if LC_ALL is unset

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to rust-coreutils in Ubuntu.
https://bugs.launchpad.net/bugs/2154042

Title:
  ls: files are not sorted in alphabetical order when using --group-
  directories-first or if LC_ALL is unset

Status in rust-coreutils:
  Unknown
Status in rust-coreutils package in Ubuntu:
  New

Bug description:
  Since upgrading from Noble 24.04 to Resolute 26.04, files and folders
  are not sorted in proper alphabetical order when running ls --group-
  directories-first in Ptyxis. The sort order appears roughly
  alphabetical but with many exceptions, and there is no obvious pattern
  to explain the deviations. Casing does not appear to be a factor
  either.

  I tried switching locales but the following give incorrect sort
  results:

  LC_ALL=C /usr/bin/ls -hlF --group-directories-first
  LC_ALL=en_US.UTF-8 /usr/bin/ls -hlF --group-directories-first

  Switching to gnuls restores proper alphabetical sorting.

  ---

  ProblemType: Bug
  DistroRelease: Ubuntu 26.04
  Package: rust-coreutils 0.8.0-0ubuntu3
  ProcVersionSignature: Ubuntu 7.0.0-17.17-generic 7.0.2
  Uname: Linux 7.0.0-17-generic x86_64
  ApportVersion: 2.34.0-0ubuntu2
  Architecture: amd64
  CasperMD5CheckResult: unknown
  CurrentDesktop: ubuntu:GNOME
  Date: Fri May 22 14:10:52 2026
  InstallationDate: Installed on 2020-07-06 (2146 days ago)
  InstallationMedia: Ubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
  ProcEnviron:
   LANG=en_US.UTF-8
   PATH=(custom, no user)
   SHELL=/bin/bash
   TERM=xterm-256color
   XDG_RUNTIME_DIR=<set>
  SourcePackage: rust-coreutils
  UpgradeStatus: Upgraded to resolute on 2026-05-06 (16 days ago)

To manage notifications about this bug go to:
https://bugs.launchpad.net/rust-coreutils/+bug/2154042/+subscriptions





More information about the foundations-bugs mailing list