From a2cebacf9748d60d6763f8ada68a10958a9cbda2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 3 Aug 2010 10:24:11 -0700 Subject: sort: fix bug in --debug when \0 is followed by \t * src/sort.c (debug_width): New function, which does not stop counting tabs at \0, and also invokes mbsnwidth. Stamp out strnlen! (count_tabs): Remove. (debug_key): Use debug_width instead of mbsnwidth and count_tabs. * tests/misc/sort-debug-keys: Check that \0 and \t intermix. --- tests/misc/sort-debug-keys | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tests/misc') diff --git a/tests/misc/sort-debug-keys b/tests/misc/sort-debug-keys index 36b67d27d..54bac5793 100755 --- a/tests/misc/sort-debug-keys +++ b/tests/misc/sort-debug-keys @@ -236,6 +236,8 @@ ___ _ 2b _ +>a + _ EOF ( @@ -274,6 +276,9 @@ printf "2,,3\n2.4\n" | sort -s -k1n --debug # -z means we convert \0 to \n printf "1a\x002b\x00" | sort -s -n -z --debug + +# Check that \0 and \t intermix. +printf "\0\ta\n" | sort -s -k2b,2 --debug | tr -d '\0' ) > out compare out exp || fail=1 -- cgit v1.2.3-70-g09d2