This case was overlooked in commit
bdde34f9, 2010-08-05,
"sort: tune and refactor --debug code, and fix minor underlining bug"
* src/sort.c (debug_key): Don't adjust the key end when
it's before the key start.
* tests/misc/sort-debug-keys: Add a test case.
char *tighter_lim = beg;
- if (key->month)
+ if (lim < beg)
+ tighter_lim = lim;
+ else if (key->month)
getmonth (beg, &tighter_lim);
else if (key->general_numeric)
ignore_value (strtold (beg, &tighter_lim));
_
>a
_
+A>chr10
+ ^ no match for key
+B>chr1
+ ^ no match for key
EOF
(
# Check that \0 and \t intermix.
printf '\0\ta\n' | sort -s -k2b,2 --debug | tr -d '\0'
+
+# Check that key end before key start is not underlined
+printf 'A\tchr10\nB\tchr1\n' | sort -s -k2.4b,2.3n --debug
) > out
compare out exp || fail=1