Bug 17749
Summary: | sort generating incorrect sort order | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | Need Real Name <a.f.3> |
Component: | textutils | Assignee: | Bernhard Rosenkraenzer <bero> |
Status: | CLOSED NOTABUG | QA Contact: | |
Severity: | low | Docs Contact: | |
Priority: | medium | ||
Version: | 6.2 | CC: | juha.laiho |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2000-09-20 16:48:40 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Need Real Name
2000-09-20 16:48:31 UTC
It's actually a feature (locale sorting). Use export LC_COLLATE="C" or whatever | LC_COLLATE="C" sort to get the old behavior. Setting $LANG causes the behaviour to change. For example: % echo -e "a\nB" | LANG= sort B a % echo -e "a\nB" | LANG=en sort B a % echo -e "a\nB" | LANG=en_US sort a B Why should 'en' and 'en_US' be different? (The same problem applies to en_GB, en_AU; fr is okay but fr_FR is broken...) There are a huge number of shell scripts, Makefiles and other programs out there that expect sort to sort case-sensitively and in ASCII order. They probably don't expect that the sort order will change due to random environment variables. So I'd say that the default should be to keep the traditional sort order (at least when the input data is ASCII) unless the user specifically asks for something else. The reason why 'en' is different to 'en_US' is that while the stuff in /usr/share/locale/ is part of glibc, locale/en/ is generated by the package 'kpilot'! I'm not sure why kpilot feels it needs a locale all to itself, but the package probably needs fixing. Similarly, some KDE packages have generated an en_UK/ directory when the correct name should be en_GB/. This is probably a bug in KDE. BTW, I strongly disagree with the resolution 'NOTABUG'. Breaking the behaviour of sort(1) is about as close to a major bug as you can get. Although I realize that POSIX mandates the brokenness. The sheer number of bug reports submitted about this should be an indication that sort is not doing the Right Thing. The manual page could be a lot clearer about what is going on - it mentions $LC_COLLATE but not $LANG. Other things in the manual page like '-f fold lower case to upper case' are also misleading if the sort order has already been modified by a locale. Let's add a worse effect caused by the same default: using a locale-aware shell (such as bash 2), what happens with rm [A-Z]* 1) "en_US" locale settings: Removes every file whose name starts with a letter, except if the letter is a lowcase z. 2) "C" locale settings: Removes every file whose name starts with a capital letter. Yes, this still works as documented, but choosing default environment that works this much differently from what has been considered "normal behaviour" should have a big warning sticker taped on a visible place. |