Skip to content

sort -rn produces output different from gnusort #13319

Description

@svetasmirnova

I have a file with the following content:

$ cat /tmp/sveta 
      1 lock/lock0lock.c line 5163
      1 lock/lock0lock.c line 3249
      1 fsp/fsp0fsp.c line 3395
      1 btr/btr0cur.c line 672
      1 btr/btr0cur.c line 450
      1 ./include/btr0btr.ic line 53

If I run gnusort on my file, I get the following results (expected):

$ gnusort -r /tmp/sveta 
      1 lock/lock0lock.c line 5163
      1 lock/lock0lock.c line 3249
      1 ./include/btr0btr.ic line 53
      1 fsp/fsp0fsp.c line 3395
      1 btr/btr0cur.c line 672
      1 btr/btr0cur.c line 450

With sort -nr I get a different order (pay attention for the last line):

$ sort -nr /tmp/sveta 
      1 lock/lock0lock.c line 5163
      1 lock/lock0lock.c line 3249
      1 fsp/fsp0fsp.c line 3395
      1 btr/btr0cur.c line 672
      1 btr/btr0cur.c line 450
      1 ./include/btr0btr.ic line 53

However, if I use pipe sort -n | sort -r, the results are the same as with gnusort:

$ sort -n /tmp/sveta | sort -r
      1 lock/lock0lock.c line 5163
      1 lock/lock0lock.c line 3249
      1 ./include/btr0btr.ic line 53
      1 fsp/fsp0fsp.c line 3395
      1 btr/btr0cur.c line 672
      1 btr/btr0cur.c line 450

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions