This service will be undergoing maintenance at 00:00 UTC, 2016-08-01. It is expected to last about 1 hours
Bug 428679 - Sort behaves as if the -b and -d options are always set
Sort behaves as if the -b and -d options are always set
Status: CLOSED NOTABUG
Product: Fedora
Classification: Fedora
Component: coreutils (Show other bugs)
8
i386 Linux
low Severity medium
: ---
: ---
Assigned To: Ondrej Vasik
Fedora Extras Quality Assurance
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2008-01-14 10:35 EST by Harold Kornylak
Modified: 2008-01-14 12:52 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2008-01-14 12:52:25 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Harold Kornylak 2008-01-14 10:35:04 EST
Description of problem:

Sort is set up to behave as if the -b and -d options are always set, namely 
that if 
a blank or a special character are in column one of a specified field, then 
sort looks ahead for the first alphanumeric character and uses that to begin 
the key.  This is not in accordance with the man pages, and I need to be 
able to sort on the field I specified for my programs to work correctly. 
How do I unseclect this behavior?  Specifically, I want column one of each 
field to be 
ordered all on it's own, and only then to look at column two, unless I ask 
for -b or -d.


Version-Release number of selected component (if applicable):
All versions from Fedora 6 to 8

How reproducible:
Always

Steps to Reproduce:
1.
2.
3.
  
Actual results:


a
 a
  a
_a
A
aa
Z
_Z

Expected results:
  a
 a
_a
_Z
a
aa
A
Z

Additional info:

So far the only workaround I found is to sort each column as a separate 
field such as -k 1.1,1.1 -k 1.2,1.2 etc
Comment 1 Ondrej Vasik 2008-01-14 12:52:25 EST
As written in man pages:
*** WARNING *** The locale specified by the  environment  affects  sort
order.  Set LC_ALL=C to get the traditional sort order that uses native
byte values.

You are using en_US locale, which gives you output as is in actual results.
With LC_ALL=C you will get:
  a
 a
A
Z
_Z
_a
a
aa
- sorted by common ASCII table and no leading space skipped. So sorry, but
NOTABUG for me - expected behaviour for that locale. So your problem has nothing
to do with -b and -d always set, but more with locales (I checked the sourcecode
quickly and -b -d are not always set in sort.c code). Feel free to reopen it if
I missed something. You could ask about that behaviour in upstream mailing list
if you really think that this behaviour is buggy(bug-coreutils@gnu.org).

Note You need to log in before you can comment on or make changes to this bug.