Date: Fri, 20 Jan 2017 04:59:42 +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-T7UJDvNQ0R@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 Kyle Evans <bsdports@kyle-evans.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bsdports@kyle-evans.net --- Comment #4 from Kyle Evans <bsdports@kyle-evans.net> --- Created attachment 179123 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=179123&action=edit Proposed patch to address issues with bsdgrep --mmap As pointed out by Mateusz, bsdgrep --mmap does not handle EOF properly when the file does not end with a newline. I still don't get quite the performance in /usr/local/share that the original reporter does, but bsdgrep is now actually responsive in /usr/local/share. I'm attaching a patch that reworks bits of the loop in grep_fgetln to return the rest of the line and ensure that we still advance the buffer by the length of the rest of the line. This improves both the original scenario as well as Mateusz's more trivial test case. -- 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-T7UJDvNQ0R>
