Bug 86002

Summary: flaky sort command
Product: [Retired] Red Hat Linux Reporter: Franklin Abud <fabud>
Component: textutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED NOTABUG QA Contact: Ben Levenson <benl>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2003-03-12 09:31:33 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:
Attachments:
Description Flags
./sort_test should pass none

Description Franklin Abud 2003-03-12 02:10:20 UTC
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20021120
Netscape/7.01

Description of problem:
when sort command is used "sort -fd <filename>", sort should sort characters
first e.g. #no, %price then number then letters and so on and so forth.

Version-Release number of selected component (if applicable):


How reproducible:
Always

Steps to Reproduce:
1.vi filename
adsf
dadf
fadf
adff
@dsf
1dsf
fatg
aser
%dff
reaf
ftea
gata
gfae

2 sort -fd filename

 
    

Actual Results:  
1dsf
adff
adsf
aser
dadf
%dff
@dsf
fadf
fatg
ftea
gata
gfae
reaf


Expected Results:  
%dff
@dsf
1dsf
adff
adsf
aser
dadf
fadf
fatg
ftea
gata
gfae
reaf


Additional info:

got this formula from our customer, he uses this to test the sort command.I'm
not really sure if the syntax where correct, but it work for me in Red Hat 7.2
but not in RH 7.3 and 8.0.

DEF
#hij
123
EOF

cat > /tmp/sort_test0 << EOF
#hij
123
DEF
abc
EOF

/bin/sort /tmp/sort_test1 > /tmp/sort_test2

diff /tmp/sort_test0 /tmp/sort_test2
if [ "$?" -eq 0 ]
then
        echo Sort test passed
else
        echo Sort test FAILED
        exit 1
fi

Comment 1 Franklin Abud 2003-03-12 02:12:53 UTC
Created attachment 90567 [details]
./sort_test should pass

Comment 2 Tim Waugh 2003-03-12 09:31:33 UTC
Nope, not unless you're in the POSIX locale.  You forgot to set LC_COLLATE=C.