[Bug 165471] bsdgrep(1) hang/very slow with mmap

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Fri Jan 20 04:59:43 UTC 2017


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165471

Kyle Evans <bsdports at kyle-evans.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bsdports at kyle-evans.net

--- Comment #4 from Kyle Evans <bsdports at 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.


More information about the freebsd-bugs mailing list