summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-03-31 10:21:58 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-03-31 10:24:07 -0700
commitd08381bc261d95502a205f7214686f80383c9692 (patch)
tree7cb9c052f70fe75fe4474233a6ca500afacc871b /tests
parent2d8ae88a228ac82c725f22aaee24accde8a12dcf (diff)
downloadcoreutils-d08381bc261d95502a205f7214686f80383c9692.tar.xz
head: fix bug with head -c-N when stdin is not at start
* src/head.c (elide_tail_bytes_file): Fix typo in lseek invocation. * tests/misc/head-c.sh: Add test for this bug. * NEWS: Document this.
Diffstat (limited to 'tests')
-rwxr-xr-xtests/misc/head-c.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/misc/head-c.sh b/tests/misc/head-c.sh
index 00d5f6018..d6433d0dd 100755
--- a/tests/misc/head-c.sh
+++ b/tests/misc/head-c.sh
@@ -29,6 +29,14 @@ case "$(cat out)" in
*) fail=1 ;;
esac
+# Test for a bug in coreutils 5.0.1 through 8.22.
+printf 'abc\ndef\n' > in1 || framework_failure_
+(dd bs=1 skip=1 count=0 status=none && head -c-4) < in1 > out1 || fail=1
+case "$(cat out1)" in
+ bc) ;;
+ *) fail=1 ;;
+esac
+
# Only allocate memory as needed.
# Coreutils <= 8.21 would allocate memory up front
# based on the value passed to -c