From owner-freebsd-bugs@FreeBSD.ORG Thu Jul 17 11:48:28 2014 Return-Path: Delivered-To: freebsd-bugs@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 3FF2CD66 for ; Thu, 17 Jul 2014 11:48:28 +0000 (UTC) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 27CC92D78 for ; Thu, 17 Jul 2014 11:48:28 +0000 (UTC) Received: from bugs.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.14.8/8.14.8) with ESMTP id s6HBmSDo023058 for ; Thu, 17 Jul 2014 11:48:28 GMT (envelope-from bugzilla-noreply@freebsd.org) From: bugzilla-noreply@freebsd.org To: freebsd-bugs@FreeBSD.org Subject: [Bug 165471] bsdgrep(1) hang/very slow with mmap Date: Thu, 17 Jul 2014 11:48:28 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: mjg@FreeBSD.org X-Bugzilla-Status: In Discussion X-Bugzilla-Priority: Normal X-Bugzilla-Assigned-To: freebsd-bugs@FreeBSD.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Jul 2014 11:48:28 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=165471 Mateusz Guzik changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mjg@FreeBSD.org --- Comment #3 from Mateusz Guzik --- 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.