Subject: bug#22084: Potential Bug in sort -r

From: Adrià Rovira <[email-masked]>
Date: Thu, 03 Dec 2015 13:30:06 +0100

Dear GNU,

I am using the sort command in  (GNU coreutils) version 8.13

I noticed the reverse option is not correctly applied if it has to sort by
more than one column.

This behaviour is corrected by forcing again the type of sort.

This happens with -n and -g.

Example:

echo -e "930 7.83\n930 77.52\n930 54.09" | sort -n -k1 -k2r
930 7.83
930 77.52
930 54.09
echo -e "930 7.83\n930 77.52\n930 54.09" | sort -n -k1 -k2rn
930 77.52
930 54.09
930 7.83

Kind Regards,

Adrià and Deimos
  --------------------------------------------------------
o o o | Adrià Rovira Garcia
o o o | Research group of Astronomy and GEomatics (gAGE)
o o o | Universitat Politècnica de Catalunya (UPC)
--------------------------------------------------------

gAGE / UPC
Departament de Matemàtiques
C/. Jordi Girona 1-3
Campus Nord UPC
Building C3, Office 211
08034 Barcelona, Spain
Tel:+34 93 401 25 31
Fax:+34 93 401 59 81
http://www.gage.upc.edu