Bug 428679 - Sort behaves as if the -b and -d options are always set
Summary: Sort behaves as if the -b and -d options are always set
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: coreutils
Version: 8
Hardware: i386
OS: Linux
low
medium
Target Milestone: ---
Assignee: Ondrej Vasik
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-01-14 15:35 UTC by Harold Kornylak
Modified: 2008-01-14 17:52 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-01-14 17:52:25 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Harold Kornylak 2008-01-14 15:35:04 UTC
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 17:52:25 UTC
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).


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