From nobody Mon Sep 20 08:27:21 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id A4E0517CE9B3 for ; Mon, 20 Sep 2021 08:27:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HCd2x3p4Yz3h7g for ; Mon, 20 Sep 2021 08:27:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B168544C for ; Mon, 20 Sep 2021 08:27:21 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 18K8RLrj013761 for ; Mon, 20 Sep 2021 08:27:21 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 18K8RLfb013760 for bugs@FreeBSD.org; Mon, 20 Sep 2021 08:27:21 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 258616] fgrep fails to find string that is present Date: Mon, 20 Sep 2021 08:27:21 +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: 12.2-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: dtucker@dtucker.net X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D258616 --- Comment #3 from Darren Tucker --- oh, it looks like /usr/bin/grep is gnu/usr.bin/grep and not usr.bin/grep: $ grep --version grep (GNU grep) 2.5.1-FreeBSD [...] building gnu/usr.bin/grep does indeed reproduce the problem. I reproduced the problem with stock GNU grep v2.5.1 and found that it was f= ixed between 2.18 and 2.19 in this upstream commit: commit 757381e58d669729510a89c323d4698f9a81f6c0 Author: Norihiro Tanaka Date: Sat Mar 15 14:41:52 2014 +0900 grep: use the Galil rule for Boyer-Moore algorithm in KWSet The Boyer-Moore algorithm is O(m*n), which means it may be much slower than the DFA. Its Galil rule variant is O(n) and increases efficiency in the typical case; it skips sections that are known to match and does not compare more than once for a position in the text. To use the Galil rule, look for the delta2 shift at each position from the trie instead of the 'mind2' value. * src/kwset.c (struct kwset): Replace member 'mind2' with 'shift'. (kwsprep): Look for the delta2 shift. (bmexec): Use it. --=20 You are receiving this mail because: You are the assignee for the bug.=