Date: Thu, 17 Jul 2014 11:48:28 +0000 From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 165471] bsdgrep(1) hang/very slow with mmap Message-ID: <bug-165471-8-7y1Gvmewu1@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-165471-8@https.bugs.freebsd.org/bugzilla/> References: <bug-165471-8@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165471 Mateusz Guzik <mjg@FreeBSD.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mjg@FreeBSD.org --- Comment #3 from Mateusz Guzik <mjg@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.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-165471-8-7y1Gvmewu1>