Add test for the bug fixed today.
authorJim Meyering <jim@meyering.net>
Sat, 10 Sep 2005 14:06:29 +0000 (14:06 +0000)
committerJim Meyering <jim@meyering.net>
Sat, 10 Sep 2005 14:06:29 +0000 (14:06 +0000)
tests/misc/csplit

index 5ea8a6a..740df9e 100755 (executable)
@@ -86,4 +86,13 @@ EOF
 cmp err experr || fail=1
 test $fail = 1 && diff err experr 2> /dev/null
 
+# Ensure that lines longer than the initial buffer length don't cause
+# trouble (e.g. reading from freed memory, resulting in corrupt output).
+# This test failed at least in coreutils-5.2.1 and 5.3.0, and was fixed
+# in 5.3.1.
+rm -f in out exp err experr xx??
+printf 'x%8199s\nx\n%8199s\nx\n' x x > in
+csplit in '/x/' '{*}' > /dev/null || fail=1
+cat xx?? | cmp - in || fail=1
+
 (exit $fail); exit $fail