From fa2cf40451c328ade606dda129ca691c5e4d6030 Mon Sep 17 00:00:00 2001 From: James Bonfield Date: Tue, 7 Jul 2026 14:50:06 +0100 Subject: [PATCH] Make gtcheck use a stable sort for "idbl" Qsort isn't always a stable sort. Use the array index for ties. (We could use the pointers themselves, but the struct already contains an index.) Fixes a test issue on OpenSolaris, and probably Alpine (although it looks to have gotten lucky.) Signed-off-by: James Bonfield --- vcfgtcheck.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcfgtcheck.c b/vcfgtcheck.c index 6fae85581..5aa29b7c5 100644 --- a/vcfgtcheck.c +++ b/vcfgtcheck.c @@ -827,7 +827,7 @@ static int cmp_idbl(const void *_a, const void *_b) idbl_t *b = (idbl_t*)_b; if ( a->val < b->val ) return -1; if ( a->val > b->val ) return 1; - return 0; + return a->ism - b->ism; // j^{th} } static void report_distinctive_sites(args_t *args) {