Subject: Bug in sort with keys and reverse, and version-sort and reverse

From: Larry Ploetz <[email-masked]>
Date: Tue, 24 May 2022 19:00:04 -0700

I think I've found a bug in sort (git branch master). The --reverse flag 
seems to be ignored when --keys are supplied.

    larryp-MBP:bin larry$ ./sort --version
    sort (GNU coreutils) 9.1.17-a351f
    Copyright (C) 2022 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later<https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Mike Haertel and Paul Eggert.
    larryp-MBP:bin larry$ ./sort -r <<< $'a\nb'
    b
    a
    larryp-MBP:bin larry$ ./sort -rk1,1 <<< $'a\nb'
    a
    b

This may be related to a bug reported in February where --version-sort 
sorted incorrectly.

    larryp-MBP:bin larry$ ./sort -Vr <<< $'1\n2'
    1
    2
    larryp-MBP:bin larry$ ./sort -V <<< $'1\n2'
    1
    2

Current version:

    larryp-MBP:bin larry$ sort --version
    sort (GNU coreutils) 9.1
    Copyright (C) 2022 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later<https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Mike Haertel and Paul Eggert.
    larryp-MBP:bin larry$ sort -rk1,1 <<< $'a\nb'
    b
    a

Thanks,
· Larry