Skip to content

ls: ignore capitalization while sorting #5330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

ThomasFrans
Copy link

  • Ignore capitalization when sorting entries, just like the GNU version does.

- Ignore capitalization when sorting entries, just like the GNU version
  does.
@ThomasFrans
Copy link
Author

ThomasFrans commented Sep 27, 2023

There seems to have been a regression regarding the default sorting of the ls command. This fixes that. Hopefully everything is correct as this is my first PR here. I haven't found an issue regarding this bug specifically.

@tertsdiepraam
Copy link
Member

Hi! Thanks for contributing!

Unfortunately, this issue is not that easy to solve. GNU's sorting is based on locale. So if you change your locale, the order changes. In the Unicode standard, this is called collation. We don't have that implemented (yet!), so for now, we match the "C" locale. You can try this out yourself. This should give you the same order with both GNU and uutils:

LC_ALL=C ls

So, it's the collation that makes the sorting case-insensitive. To implement this correctly, without breaking the C locale, we need to support multiple locales, which is a big project (but definitely something we want to do).

The issue for localization is here: #3997

See also previous attempts at this:

If you want to avoid this kind of situation in the future, please open an issue before making a change, so we can help out!

@ThomasFrans
Copy link
Author

Ah OK, thought it was an easy fix that just went unnoticed. Didn't know those PRs and issues were related. Also the PR was wrong anyway as is. Will close this 🙂

@tertsdiepraam
Copy link
Member

tertsdiepraam commented Sep 27, 2023

I understand, you're not the first who thought that, myself included a few years back 😄 Thanks anyway!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants