[Bug 10671] New: sort -s is not stable

bugzilla at busybox.net bugzilla at busybox.net
Tue Jan 23 20:23:07 UTC 2018


https://bugs.busybox.net/show_bug.cgi?id=10671

            Bug ID: 10671
           Summary: sort -s is not stable
           Product: Busybox
           Version: unspecified
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P5
         Component: Other
          Assignee: unassigned at busybox.net
          Reporter: 9qq3ip+an9ogcgv8nr9g at pokemail.net
                CC: busybox-cvs at busybox.net
  Target Milestone: ---

Someone on the Alpine Linux users mailing list observed that "sort -s" is not
stable as intended.
  "
   The following two commands (with and without -s) give different
   result on alpine linux 3.6.2/amd64,
   with busybox v1.26.2 (2017-08-03 13:08:12 GMT):

     $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1
     A X 2
     A x 5
     a X 1

     $ printf "a X 1\nA X 2\nA x 5\n" | sort -k1,1 -s
     A x 5
     A X 2
     a X 1
  "

Another user observed that sort.c uses qsort(), which is documented as not
stable, and suggested adding the line number as an additional (internal) key to
make it so.

Here are the mailing list posts:
  https://lists.alpinelinux.org/alpine-user/0178.html
  https://lists.alpinelinux.org/alpine-user/0180.html

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the busybox-cvs mailing list