[Bug 165471] bsdgrep(1) hang/very slow with mmap
bugzilla-noreply at freebsd.org
bugzilla-noreply at freebsd.org
Thu Jul 17 11:48:28 UTC 2014
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165471
Mateusz Guzik <mjg at FreeBSD.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mjg at FreeBSD.org
--- Comment #3 from Mateusz Guzik <mjg at FreeBSD.org> ---
bsdgrep --mmap does not handle files without newlines at the end properly
issue can be reproduced with:
$ echo -n foo > file
$ bsdgrep --mmap meh file
I don't know this code and I'm not interested in changing it, but the following
hack fixes:
diff --git a/usr.bin/grep/file.c b/usr.bin/grep/file.c
index 6bcaa52..f056697 100644
--- a/usr.bin/grep/file.c
+++ b/usr.bin/grep/file.c
@@ -83,12 +83,12 @@ grep_refill(struct file *f)
{
ssize_t nr;
- if (filebehave == FILE_MMAP)
- return (0);
-
bufpos = buffer;
bufrem = 0;
+ if (filebehave == FILE_MMAP)
+ return (0);
+
if (filebehave == FILE_GZIP) {
nr = gzread(gzbufdesc, b
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the freebsd-bugs
mailing list