summaryrefslogtreecommitdiff
path: root/bootstrap.conf
diff options
context:
space:
mode:
authorJim Meyering <meyering@fb.com>2013-12-14 09:34:08 -0800
committerJim Meyering <meyering@fb.com>2013-12-18 10:33:49 -0800
commit9316d536321af0c44f75a1e62d910f6444f02318 (patch)
treeb0f51255f32b7d5b1b8942865ee7d1db44b92f10 /bootstrap.conf
parent84b18cc1aecd61149fc8b686d8665e7c59f784a5 (diff)
downloadgrep-9316d536321af0c44f75a1e62d910f6444f02318.tar.gz
grep: handle lines longer than INT_MAX on more systems
When trying to exercize some long-line-handling code, I ran these commands: $ dd bs=1 seek=2G of=big < /dev/null; grep -l x big; echo $? grep: big: Invalid argument 2 grep should not have issued that diagnostic, and it should have exited with status 1, not 2. What happened? grep read the 2GiB of NULs, doubled its buffer size, copied the 2GiB into the new 4GiB buffer, and proceeded to call "read" with a byte-count argument of 2^32. On at least Darwin 12.5.0, that makes read fail with EINVAL. The solution is to use gnulib's safe_read wrapper. * src/main.c: Include "safe-read.h" (fillbuf): Use safe_read, rather than bare read. The latter cannot handle a read size of 2^32 on some systems. * bootstrap.conf (gnulib_modules): Add safe-read. * tests/long-line-vs-2GiB-read: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it.
Diffstat (limited to 'bootstrap.conf')
-rw-r--r--bootstrap.conf1
1 files changed, 1 insertions, 0 deletions
diff --git a/bootstrap.conf b/bootstrap.conf
index 8f6f5a3d..580f01c2 100644
--- a/bootstrap.conf
+++ b/bootstrap.conf
@@ -68,6 +68,7 @@ quote
readme-release
realloc-gnu
regex
+safe-read
same-inode
ssize_t
stddef