summaryrefslogtreecommitdiff
path: root/tests/misc
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2010-08-03 10:24:11 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2010-08-03 10:25:47 -0700
commita2cebacf9748d60d6763f8ada68a10958a9cbda2 (patch)
tree4c911b6105aa863c8a9073d262fb3796f8295e7f /tests/misc
parent94615d2acfdccbbeb8eb6f8931d0e252b05e1484 (diff)
downloadcoreutils-a2cebacf9748d60d6763f8ada68a10958a9cbda2.tar.xz
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.
Diffstat (limited to 'tests/misc')
-rwxr-xr-xtests/misc/sort-debug-keys5
1 files changed, 5 insertions, 0 deletions
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