From cc7d2e21780c28608b00a4faf0fed297527bcbf4 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 4 Jan 2022 23:53:21 +0100 Subject: sort: fix -s -r interaction: 'stable' order is not affected by -r function old new delta compare_keys 818 820 +2 Signed-off-by: Denys Vlasenko --- coreutils/sort.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'coreutils') diff --git a/coreutils/sort.c b/coreutils/sort.c index 0cbb6f597..9ff777851 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -380,7 +380,9 @@ static int compare_keys(const void *xarg, const void *yarg) /* If x > y, 1, else -1 */ retval = (x32 > y32) * 2 - 1; - } else + /* Here, -r has no effect! */ + return retval; + } if (!(option_mask32 & FLAG_no_tie_break)) { /* fallback sort */ flags = option_mask32; -- cgit v1.2.3-55-g6feb