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

看板FB_bugs作者時間11年前 (2014/07/17 20:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串2/2 (看更多)
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. _______________________________________________ freebsd-bugs@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-bugs To unsubscribe, send any mail to "freebsd-bugs-unsubscribe@freebsd.org"
文章代碼(AID): #1Jnxi0nD (FB_bugs)
文章代碼(AID): #1Jnxi0nD (FB_bugs)