Bug 204571 - sort with multiple numerical keys fail in sparc64
Summary: sort with multiple numerical keys fail in sparc64
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-STABLE
Hardware: sparc64 Any
: --- Affects Many People
Assignee: Gabor Kovesdan
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-11-15 21:25 UTC by Rodrigo Osorio
Modified: 2017-05-10 20:31 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rodrigo Osorio freebsd_committer freebsd_triage 2015-11-15 21:25:38 UTC
If you have a file with numerical values like the one bellow :

% cat testfile
12 1 3
19 1 6
2 1 1
7 1 2
1 2 1
16 2 4

% sort -k2n testfile
2 1 1
7 1 2
12 1 3
19 1 6
1 2 1
16 2 4

% sort -k2n -k1n testfile

returns nothing but error 255
The same if we try any combination if the first key is numeric

Investigations on the code shows that we fail in mt_sort() function.
Comment 1 commit-hook freebsd_committer freebsd_triage 2016-12-28 17:13:38 UTC
A commit references this bug:

Author: marius
Date: Wed Dec 28 17:13:04 UTC 2016
New revision: 310712
URL: https://svnweb.freebsd.org/changeset/base/310712

Log:
  - Use correct offsets into the keys set array. As the elements of this
    zero-length array are dynamically sized at run-time based on the use
    of hints, compilers can't be expected to figure out these offsets on
    their own. [1]
  - Fix incorrect comparison in cmp_nans(). [2]

  PR:		204571 [1], 202301 [2]
  Submitted by:	David Binderman [2]
  MFC after:	3 days

Changes:
  head/usr.bin/sort/coll.c
  head/usr.bin/sort/coll.h
  head/usr.bin/sort/radixsort.c
Comment 2 commit-hook freebsd_committer freebsd_triage 2017-05-10 20:29:09 UTC
A commit references this bug:

Author: marius
Date: Wed May 10 20:29:02 UTC 2017
New revision: 318152
URL: https://svnweb.freebsd.org/changeset/base/318152

Log:
  MFC: r310712

  - Use correct offsets into the keys set array. As the elements of this
    zero-length array are dynamically sized at run-time based on the use
    of hints, compilers can't be expected to figure out these offsets on
    their own. [1]
  - Fix incorrect comparison in cmp_nans(). [2]

  PR:		204571 [1], 202301 [2]
  Submitted by:	David Binderman [2]

Changes:
_U  stable/10/
  stable/10/usr.bin/sort/coll.c
  stable/10/usr.bin/sort/coll.h
  stable/10/usr.bin/sort/radixsort.c
Comment 3 commit-hook freebsd_committer freebsd_triage 2017-05-10 20:30:14 UTC
A commit references this bug:

Author: marius
Date: Wed May 10 20:29:33 UTC 2017
New revision: 318153
URL: https://svnweb.freebsd.org/changeset/base/318153

Log:
  MFC: r310712

  - Use correct offsets into the keys set array. As the elements of this
    zero-length array are dynamically sized at run-time based on the use
    of hints, compilers can't be expected to figure out these offsets on
    their own. [1]
  - Fix incorrect comparison in cmp_nans(). [2]

  PR:		204571 [1], 202301 [2]
  Submitted by:	David Binderman [2]

Changes:
_U  stable/11/
  stable/11/usr.bin/sort/coll.c
  stable/11/usr.bin/sort/coll.h
  stable/11/usr.bin/sort/radixsort.c