Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
For bugs related to Red Hat Enterprise Linux 3 product line. The current stable release is 3.9. For Red Hat Enterprise Linux 6 and above, please visit Red Hat JIRA https://issues.redhat.com/secure/CreateIssue!default.jspa?pid=12332745 to report new issues.

Bug 115620

Summary: /bin/sort -g has memory leak
Product: Red Hat Enterprise Linux 3 Reporter: Jeff Janes <janes>
Component: coreutilsAssignee: Tim Waugh <twaugh>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 3.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2005-544 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2005-09-28 17:00:59 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:
Bug Depends On:    
Bug Blocks: 156320, 209300    

Description Jeff Janes 2004-02-13 22:51:41 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Description of problem:
When sorting large amounts of data using the general numeric
sort flag (-g), it takes huge amounts of memory, and may eventually
crash.



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

How reproducible:
Always

Steps to Reproduce:
1.perl -le'print rand() foreach 1..5_000_000'|/bin/sort -g > /dev/null
2.
3.
    

Actual Results:  Depending on the size of the input, either uses much 
more memory than it should, or it dies with a memory error 
(either "Killed" or "Sort: memory exhausted").

Expected Results:  I expect it use about 33M of main memory (plus 
whatever tmp file space is necessary) to finish the sort.

Additional info:

The binary reports itself as gnu's sort 4.5.3:

$ /bin/sort --version
sort (coreutils) 4.5.3
Written by Mike Haertel and Paul Eggert.

However, if I download and build the 4.5.3 coreutils source
from gnu, that executable does not exhibit this problem.  (It 
performs the sort using about 33M of main memory)

Comment 1 Tim Waugh 2004-02-18 13:01:42 UTC
Indeed.  This comes from the i18n patch.  I've fixed this in CVS, and
the fix will be part of any future coreutils update for RHEL3.

A fixed package will also appear in Fedora development tree shortly, FWIW.

Comment 9 Red Hat Bugzilla 2005-09-28 17:00:59 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2005-544.html