From debbugs-submit-bounces@debbugs.gnu.org Sun Oct 11 19:56:04 2015 Received: (at submit) by debbugs.gnu.org; 11 Oct 2015 23:56:04 +0000 Received: from localhost ([127.0.0.1]:36554 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlQTD-0006Mo-UQ for submit@debbugs.gnu.org; Sun, 11 Oct 2015 19:56:04 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46883) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlNk0-00021E-31 for submit@debbugs.gnu.org; Sun, 11 Oct 2015 17:01:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlNjy-000650-Jt for submit@debbugs.gnu.org; Sun, 11 Oct 2015 17:01:11 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM, HTML_MESSAGE,T_DKIM_INVALID autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:43075) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlNjy-00064w-Gx for submit@debbugs.gnu.org; Sun, 11 Oct 2015 17:01:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:56885) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlNjx-0007n2-IB for bug-grep@gnu.org; Sun, 11 Oct 2015 17:01:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZlNjw-00064h-E4 for bug-grep@gnu.org; Sun, 11 Oct 2015 17:01:09 -0400 Received: from mail-yk0-x22a.google.com ([2607:f8b0:4002:c07::22a]:36240) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZlNjw-00064d-8o for bug-grep@gnu.org; Sun, 11 Oct 2015 17:01:08 -0400 Received: by ykba192 with SMTP id a192so116562627ykb.3 for ; Sun, 11 Oct 2015 14:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=ds1chy27MOEFPLgdYScCUzVr8l8a5trz41I44HrLmek=; b=Aw4YKbhMGH9xZBUZqAhc2mBSTRuHlz51nO0BC2aPo2fBANi0nzvvL44Tw8eJXPbOas +udfnec2mTugPsHNFmtimAZUfEMajLMV/BqSklyctemrlAxbbQYe9v8tw9n6acZQOAY7 I43NSd3e3G4UJcrzB66t+k565LG3bQh979+64w023FoZNYVgObtOVmsbjvYJS1R3N60O Bzdbj9Z2NjwW3dBJ9gZYuUY/0P3pavQJu7i4+Hs8svN7XrhFQuI9OXymqihGQhHUnxNN gnybAHyBUEtVdWACE4wc8e3zFTcYw7exaGZB+WFj3xcyfMEBduGwXry0CTJ+ovQciu5T KxvQ== MIME-Version: 1.0 X-Received: by 10.129.82.81 with SMTP id g78mr19829695ywb.15.1444597267545; Sun, 11 Oct 2015 14:01:07 -0700 (PDT) Received: by 10.37.223.71 with HTTP; Sun, 11 Oct 2015 14:01:07 -0700 (PDT) Date: Sun, 11 Oct 2015 14:01:07 -0700 Message-ID: Subject: surprising bug in grep -e with anchors From: greg boyd To: bug-grep@gnu.org, greg boyd Content-Type: multipart/alternative; boundary=001a114da704f9c7e30521da8270 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.0 (----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Sun, 11 Oct 2015 19:56:02 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -4.0 (----) --001a114da704f9c7e30521da8270 Content-Type: text/plain; charset=UTF-8 This bug appears in GNU grep version 2.20. It is not present in the older version I have installed on a home system (2.6.3.) test case (single line) abchelloabc grep does not find the line with grep -e '^hello' nor with grep -e 'hello$' however, the line is output with grep -e '^hello' -e 'hello$' I downloaded, built and tested the bug on GNU grep 2.21 and it still appears. weird. (this was found by an introductory Linux student. ) -- -- greg gboyd@ccsf.edu Instructor, Computer Science http://fog.ccsf.edu/~gboyd --001a114da704f9c7e30521da8270 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
This bug appears i= n GNU grep version 2.20. It is not present in the older version I have inst= alled on a home system (2.6.3.)

test case (single line)
abchelloabc

grep does not find the line with grep -e '^= hello'=C2=A0 nor with grep -e 'hello$'
however, the li= ne is output with
grep -e '^hello' -e 'hello$'
I downloaded, built and tested the bug on GNU grep 2.21 and it s= till appears.

weird.

(this was found by an introd= uctory Linux student. )

--
Instructor, Computer Science
http://fog.ccsf.edu/~gboyd
=
--001a114da704f9c7e30521da8270-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 12 00:34:10 2015 Received: (at 21670-done) by debbugs.gnu.org; 12 Oct 2015 04:34:10 +0000 Received: from localhost ([127.0.0.1]:36661 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlUoL-0007OL-Vs for submit@debbugs.gnu.org; Mon, 12 Oct 2015 00:34:10 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:49928) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlUoJ-0007O7-P6 for 21670-done@debbugs.gnu.org; Mon, 12 Oct 2015 00:34:08 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id CC0A0160CBF; Sun, 11 Oct 2015 21:34:06 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id v2mF9cdoDZxt; Sun, 11 Oct 2015 21:34:05 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id B284A160E14; Sun, 11 Oct 2015 21:34:05 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 33qJ_aWqJK0t; Sun, 11 Oct 2015 21:34:05 -0700 (PDT) Received: from [192.168.1.9] (pool-100-32-155-148.lsanca.fios.verizon.net [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 8E4EB160CBF; Sun, 11 Oct 2015 21:34:05 -0700 (PDT) Subject: Re: bug#21670: surprising bug in grep -e with anchors To: greg boyd References: From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <561B383D.6090403@cs.ucla.edu> Date: Sun, 11 Oct 2015 21:34:05 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/mixed; boundary="------------070303020702070903060703" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21670-done Cc: Norihiro Tanaka , 21670-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --------------070303020702070903060703 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit greg boyd wrote: > test case (single line) > abchelloabc > > grep does not find the line with grep -e '^hello' nor with grep -e 'hello$' > however, the line is output with > grep -e '^hello' -e 'hello$' Oooo, that's a good one. Give your student extra credit! As it happens, the bug was recently fixed by this patch by Norihiro Tanaka: http://git.savannah.gnu.org/cgit/grep.git/commit/?id=256a4b494fe1c48083ba73b4f62607234e4fefd5 and the fix should appear in the next grep release. However, since the patch was supposed to affect only performance, it appears that the bug fix was due to luck, and I'm taking the liberty of adding your student's test case by installing the attached further patch, to help prevent this bug from coming back in a future version. --------------070303020702070903060703 Content-Type: text/plain; charset=UTF-8; name="0001-tests-add-test-case-for-Bug-21670.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-tests-add-test-case-for-Bug-21670.patch" RnJvbSA2MDNkYWYxMTcxY2FmZmQyNjcwNWNmNWM4M2Q1ZGVlYmYwMmJmZDcxIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBTdW4sIDExIE9jdCAyMDE1IDIxOjI3OjUwIC0wNzAwClN1YmplY3Q6IFtQQVRD SF0gdGVzdHM6IGFkZCB0ZXN0IGNhc2UgZm9yIEJ1ZyMyMTY3MAoKKiB0ZXN0cy9vcHRpb25z OiBBZGQgdGVzdCAjNCB0byBjYXRjaCBCdWcjMjE2NzAuCkFsc28sIGRvIG5vdCBvdmVyZXNj YXBlICMgaW4gc2hlbGwgc3RyaW5ncy4KLS0tCiB0ZXN0cy9vcHRpb25zIHwgMTQgKysrKysr KysrKystLS0KIDEgZmlsZSBjaGFuZ2VkLCAxMSBpbnNlcnRpb25zKCspLCAzIGRlbGV0aW9u cygtKQoKZGlmZiAtLWdpdCBhL3Rlc3RzL29wdGlvbnMgYi90ZXN0cy9vcHRpb25zCmluZGV4 IGYyYzcxMjYuLjI0OWUyMGMgMTAwNzU1Ci0tLSBhL3Rlc3RzL29wdGlvbnMKKysrIGIvdGVz dHMvb3B0aW9ucwpAQCAtMjAsMjEgKzIwLDI5IEBAIGZhaWw9MAogIyBjaGVja2luZyBmb3Ig LUUgZXh0ZW5kZWQgcmVnZXgKIGVjaG8gImFiYWJhYmNjY2NjY2QiIHwgZ3JlcCAtRSAtZSAn Y3szfScgPiAvZGV2L251bGwgMj4mMQogaWYgdGVzdCAkPyAtbmUgMCA7IHRoZW4KLSAgICAg ICAgZWNobyAiT3B0aW9uczogV3Jvbmcgc3RhdHVzIGNvZGUsIHRlc3QgXCMxIGZhaWxlZCIK KyAgICAgICAgZWNobyAiT3B0aW9uczogV3Jvbmcgc3RhdHVzIGNvZGUsIHRlc3QgIzEgZmFp bGVkIgogICAgICAgICBmYWlsPTEKIGZpCiAKICMgY2hlY2tpbmcgZm9yIGJhc2ljIHJlZ2V4 CiBlY2hvICJhYmFiYWJjY2NjY2NkIiB8IGdyZXAgLUcgLWUgJ2NcezNcfScgPiAvZGV2L251 bGwgMj4mMQogaWYgdGVzdCAkPyAtbmUgMCA7IHRoZW4KLSAgICAgICAgZWNobyAiT3B0aW9u czogV3Jvbmcgc3RhdHVzIGNvZGUsIHRlc3QgXCMyIGZhaWxlZCIKKyAgICAgICAgZWNobyAi T3B0aW9uczogV3Jvbmcgc3RhdHVzIGNvZGUsIHRlc3QgIzIgZmFpbGVkIgogICAgICAgICBm YWlsPTEKIGZpCiAKICMgY2hlY2tpbmcgZm9yIGZpeGVkIHN0cmluZwogZWNobyAiYWJhYmFi Y2NjY2NjZCIgfCBncmVwIC1GIC1lICdjXHszXH0nID4gL2Rldi9udWxsIDI+JjEKIGlmIHRl c3QgJD8gLW5lIDEgOyB0aGVuCi0gICAgICAgIGVjaG8gIk9wdGlvbnM6IFdyb25nIHN0YXR1 cyBjb2RlLCB0ZXN0IFwjMyBmYWlsZWQiCisgICAgICAgIGVjaG8gIk9wdGlvbnM6IFdyb25n IHN0YXR1cyBjb2RlLCB0ZXN0ICMzIGZhaWxlZCIKKyAgICAgICAgZmFpbD0xCitmaQorCisj IGNoZWNraW5nIGZvciBtdWx0aXBsZSAtZSBvcHRpb25zOyBzZWU6CisjIGh0dHA6Ly9idWdz LmdudS5vcmcvMjE2NzAKK2VjaG8gYWJjaGVsbG9hYmMgfCBncmVwIC1lICdeaGVsbG8nIC1l ICdoZWxsbyQnID4gL2Rldi9udWxsIDI+JjEKK2lmIHRlc3QgJD8gLW5lIDEgOyB0aGVuCisg ICAgICAgIGVjaG8gIk9wdGlvbnM6IFdyb25nIHN0YXR1cyBjb2RlLCB0ZXN0ICM0IGZhaWxl ZCIKICAgICAgICAgZmFpbD0xCiBmaQogCi0tIAoyLjEuMAoK --------------070303020702070903060703-- From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 12 04:14:30 2015 Received: (at 21670-done) by debbugs.gnu.org; 12 Oct 2015 08:14:30 +0000 Received: from localhost ([127.0.0.1]:36800 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlYFZ-0000dJ-Nv for submit@debbugs.gnu.org; Mon, 12 Oct 2015 04:14:30 -0400 Received: from gateway22.websitewelcome.com ([192.185.47.100]:56291) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlYFW-0000dA-Ba for 21670-done@debbugs.gnu.org; Mon, 12 Oct 2015 04:14:27 -0400 Received: by gateway22.websitewelcome.com (Postfix, from userid 500) id B6312B2E71FB4; Mon, 12 Oct 2015 03:14:25 -0500 (CDT) Received: from gator4065.hostgator.com (gator4065.hostgator.com [192.185.4.76]) by gateway22.websitewelcome.com (Postfix) with ESMTP id B3C67B2E71F98 for <21670-done@debbugs.gnu.org>; Mon, 12 Oct 2015 03:14:25 -0500 (CDT) Received: from [79.183.186.181] (port=59018 helo=telaviv1.shlomifish.org) by gator4065.hostgator.com with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85) (envelope-from ) id 1ZlYFV-000EPM-8j; Mon, 12 Oct 2015 03:14:25 -0500 Received: from telaviv1.shlomifish.org (telaviv1.shlomifish.org [127.0.0.1]) by telaviv1.shlomifish.org (Postfix) with ESMTP id 609422600AE; Mon, 12 Oct 2015 11:14:21 +0300 (IDT) Date: Mon, 12 Oct 2015 11:14:21 +0300 From: Shlomi Fish To: Paul Eggert Subject: Re: bug#21670: surprising bug in grep -e with anchors Message-ID: <20151012111421.2ff56824@telaviv1.shlomifish.org> In-Reply-To: <561B383D.6090403@cs.ucla.edu> References: <561B383D.6090403@cs.ucla.edu> X-Mailer: Claws Mail 3.13.0 (GTK+ 2.24.28; x86_64-mageia-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - gator4065.hostgator.com X-AntiAbuse: Original Domain - debbugs.gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - shlomifish.org X-BWhitelist: no X-Source-IP: 79.183.186.181 X-Exim-ID: 1ZlYFV-000EPM-8j X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (telaviv1.shlomifish.org) [79.183.186.181]:59018 X-Source-Auth: shlomif@shlomifish.org X-Email-Count: 2 X-Source-Cap: c2hsb21pZjtzaGxvbWlmO2dhdG9yNDA2NS5ob3N0Z2F0b3IuY29t X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 21670-done Cc: 21670-done@debbugs.gnu.org, greg boyd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) Hi all, On Sun, 11 Oct 2015 21:34:05 -0700 Paul Eggert wrote: > greg boyd wrote: > > test case (single line) > > abchelloabc > > > > grep does not find the line with grep -e '^hello' nor with grep -e 'he= llo$' > > however, the line is output with > > grep -e '^hello' -e 'hello$' =20 >=20 > Oooo, that's a good one. Give your student extra credit! As it happens,= the=20 > bug was recently fixed by this patch by Norihiro Tanaka: >=20 > http://git.savannah.gnu.org/cgit/grep.git/commit/?id=3D256a4b494fe1c48083= ba73b4f62607234e4fefd5 >=20 > and the fix should appear in the next grep release. However, since the p= atch=20 > was supposed to affect only performance, it appears that the bug fix was = due > to luck, and I'm taking the liberty of adding your student's test case by= =20 > installing the attached further patch, to help prevent this bug from comi= ng > back in a future version. thanks to greg, to greg's student, and to Paul for their contributions! Regards, Shlomi Fish --=20 ----------------------------------------------------------------- Shlomi Fish http://www.shlomifish.org/ Perl Humour - http://perl-begin.org/humour/ The first phrase that needs to be taught when teaching a new language is ho= w to say =E2=80=9CDo you speak English?=E2=80=9D. The first thing that needs to = be taught when teaching a new computer tool is how to exit it. Please reply to list if it's a mailing list post - http://shlom.in/reply . From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 12 12:28:26 2015 Received: (at 21670) by debbugs.gnu.org; 12 Oct 2015 16:28:26 +0000 Received: from localhost ([127.0.0.1]:37253 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zlfxa-0007AM-5a for submit@debbugs.gnu.org; Mon, 12 Oct 2015 12:28:26 -0400 Received: from mail-io0-f175.google.com ([209.85.223.175]:35334) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZlfxX-0007AE-Li for 21670@debbugs.gnu.org; Mon, 12 Oct 2015 12:28:24 -0400 Received: by iofl186 with SMTP id l186so74313976iof.2 for <21670@debbugs.gnu.org>; Mon, 12 Oct 2015 09:28:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=eQ5oOdHO0itGIRxHOKEk6tH340JOsWXR0Ltoa6fRooc=; b=fV2PegXOsxVl73MibPSiZtQb+4whOEEHHhYDtx8mHgQejujoYI0K2JI1nzLspOx7Pe oPSBzdZp5EnOb2aF1VkvXWdgjXcgdrj/jEaTaUKmmtvsKGhbpeIAgWwEn17I+VPuaqqv tnys+Atbx1C19JjDQmVKS/3nBqDCQUH2zReSlFmXoEeX1pHUtFrGzc/NYhRI90VfcKPe /70Bn42KWGOyGt7AqEo0rwiv9u5nsigkiHCA2DaVAgJV/wsT0imy+JV1D5PM+JtXkcjF i6rOOSHb0HfKQsbKt7TqWRj9IAUgOaEHpTx/u/bbSfzh/C1EPNXcrZD7jfjWyo7LXoEe ajRA== X-Received: by 10.107.129.218 with SMTP id l87mr3775772ioi.181.1444667302944; Mon, 12 Oct 2015 09:28:22 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.10.66 with HTTP; Mon, 12 Oct 2015 09:28:03 -0700 (PDT) In-Reply-To: References: From: Jim Meyering Date: Mon, 12 Oct 2015 09:28:03 -0700 X-Google-Sender-Auth: xZZhJ5bTCPdKxuoQgkBlshC_yBA Message-ID: Subject: Re: bug#21670: surprising bug in grep -e with anchors To: greg boyd Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21670 Cc: 21670@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Sun, Oct 11, 2015 at 2:01 PM, greg boyd wrote: > This bug appears in GNU grep version 2.20. It is not present in the older > version I have installed on a home system (2.6.3.) > > test case (single line) > abchelloabc > > grep does not find the line with grep -e '^hello' nor with grep -e 'hello$' > however, the line is output with > grep -e '^hello' -e 'hello$' > > I downloaded, built and tested the bug on GNU grep 2.21 and it still > appears. Thank you for the report. I confirm that it affects grep-2.21 with this: $ echo axa |/p/p/grep-2.21/bin/grep -E '^x|x$' axa However, it appears to be fixed in the version built from the latest sources, yet there is no mention in NEWS. The actual bug was introduced in v2.18-85-g2c94326, so first appeared in the grep-2.19 release. I will track down the commit that fixed it, add a test if required and update NEWS accordingly. With this, I will prioritize making a new release soon. From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 12 18:18:06 2015 Received: (at 21670) by debbugs.gnu.org; 12 Oct 2015 22:18:06 +0000 Received: from localhost ([127.0.0.1]:37597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZllPx-0000CY-L6 for submit@debbugs.gnu.org; Mon, 12 Oct 2015 18:18:06 -0400 Received: from mail-ig0-f169.google.com ([209.85.213.169]:36576) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZllPu-0000CH-97; Mon, 12 Oct 2015 18:18:02 -0400 Received: by ignr19 with SMTP id r19so24691267ign.1; Mon, 12 Oct 2015 15:18:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=YHZQpjSwwbC50k4Fk3BJHLDmS6U8viu0syoEzURXqwo=; b=wqjzO6DtxbYEZJ3OCWTPBhfF0X0oGUPrYIxjXFAYGJ1eAMs8oqGKCYz/1acvreM0yM CEWQv13kUrX/PFZlU2KF8vZH4vywz6GPLTvUmZ2vncRDrg1s3Yun54Qnr5PDhOyiSMWx Bes3YIgcayLg4K6s0BfCaIkei5NKbKSmqEiWhGv/XiSTVS7chmkMzP/NknhIBnD2MLgg Dlh6a6g7+vz4w1r826mLtPKaurG9+Tos4xjEpJiXp9q2t+X5fTejVmr27eNyVygGRq7S JrNuvL/9SvQ2wqYzRzA3XTIVCO/tIMH4VA3ZvKUsnisAZsbtkgAUNZRgY+AgAnRkkRTo 1O0w== X-Received: by 10.50.110.67 with SMTP id hy3mr14538840igb.50.1444688281857; Mon, 12 Oct 2015 15:18:01 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.10.66 with HTTP; Mon, 12 Oct 2015 15:17:42 -0700 (PDT) In-Reply-To: <561B383D.6090403@cs.ucla.edu> References: <561B383D.6090403@cs.ucla.edu> From: Jim Meyering Date: Mon, 12 Oct 2015 15:17:42 -0700 X-Google-Sender-Auth: I_3iJ2ows5LqOfiRuLD72B4nZDI Message-ID: Subject: Re: bug#21670: surprising bug in grep -e with anchors To: 21670@debbugs.gnu.org, Paul Eggert , gboyd.ccsf@gmail.com Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21670 Cc: 21670-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Sun, Oct 11, 2015 at 9:34 PM, Paul Eggert wrote: > greg boyd wrote: >> >> test case (single line) >> abchelloabc >> >> grep does not find the line with grep -e '^hello' nor with grep -e >> 'hello$' >> however, the line is output with >> grep -e '^hello' -e 'hello$' > > > Oooo, that's a good one. Give your student extra credit! As it happens, > the bug was recently fixed by this patch by Norihiro Tanaka: > > http://git.savannah.gnu.org/cgit/grep.git/commit/?id=256a4b494fe1c48083ba73b4f62607234e4fefd5 > > and the fix should appear in the next grep release. However, since the > patch was supposed to affect only performance, it appears that the bug fix > was due to luck, and I'm taking the liberty of adding your student's test > case by installing the attached further patch, to help prevent this bug from > coming back in a future version. Thanks for adding that test, Paul. However, note that the bug does not require two uses of "-e" per-se. Multiple "-e"-specified regexps get translated internally to those regexps separated by the ERE "|" alternation/"or" operator. A smaller, perhaps more illustrative test case is to use an explicit "|": $ echo axa | grep -E '^x|x$' axa FYI, one can demonstrate that it was a problem in the DFA matcher without resorting to gdb by inserting a "()" in the ERE, since that construct cannot work in a DFA and grep resorts to using glibc's full-blown regex matcher. With that, even the afflicted versions of grep get the desired result (no match): $ echo axa | grep -E '^x()|x$'; echo $? $ 1 From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 13 00:22:06 2015 Received: (at 21670) by debbugs.gnu.org; 13 Oct 2015 04:22:06 +0000 Received: from localhost ([127.0.0.1]:37660 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zlr6D-0000U2-Mb for submit@debbugs.gnu.org; Tue, 13 Oct 2015 00:22:05 -0400 Received: from mail-io0-f174.google.com ([209.85.223.174]:34246) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zlr6C-0000Tt-1U for 21670@debbugs.gnu.org; Tue, 13 Oct 2015 00:22:04 -0400 Received: by iow1 with SMTP id 1so8883815iow.1 for <21670@debbugs.gnu.org>; Mon, 12 Oct 2015 21:22:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=HSCZErpSNOrb+8EWDMvWQ6oA8idiJB9UozZdgZ3Gicw=; b=L2tCohyLak4x6Jy8OG2Jyi7hvn0JIcQZWXVkeUYa+7UcWPxpLkSe4vxa+m1cAFs68l WpvTffMXmf3hUDe90gyvxoeqEYQtp13XB5dpZEvCObIv6JLHx8YzpxxZAybjckyFaEcD c9HFX4HI+I/0v2OC+WJRjEuqIDpH1PH+Ek9Br+KlWp0Hz8bS4zB8zA/aIyYt01y6FEpk vDA8mmNp0KUwpyPRuCiEF/8vL1rdxXqbxOhDKWSZdsxW3TuNnE1xZEVlRxNq8epBFFlK nNoM6aW9xx5QaB+d2Nl0I3GxndosmHzMNQdnObKd0x23YW9j3N9/L/723Ek3SfuzLNwG tBpg== X-Received: by 10.107.166.79 with SMTP id p76mr31948403ioe.163.1444710123495; Mon, 12 Oct 2015 21:22:03 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.10.66 with HTTP; Mon, 12 Oct 2015 21:21:43 -0700 (PDT) In-Reply-To: References: From: Jim Meyering Date: Mon, 12 Oct 2015 21:21:43 -0700 X-Google-Sender-Auth: fzfqiXN-Gom9jSw8nvYz5aT-FhU Message-ID: Subject: Re: bug#21670: surprising bug in grep -e with anchors To: greg boyd Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21670 Cc: 21670@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Mon, Oct 12, 2015 at 9:28 AM, Jim Meyering wrote: > On Sun, Oct 11, 2015 at 2:01 PM, greg boyd wrote: >> This bug appears in GNU grep version 2.20. It is not present in the older >> version I have installed on a home system (2.6.3.) ... > The actual bug was introduced in v2.18-85-g2c94326, > so first appeared in the grep-2.19 release. I will track down > the commit that fixed it, add a test if required and update > NEWS accordingly. Thanks again. Paul already added a test, so I've updated NEWS with the missing info: http://git.sv.gnu.org/cgit/grep.git/commit/?id=93a6d6d7bd1d68 From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 13 09:31:01 2015 Received: (at 21670-done) by debbugs.gnu.org; 13 Oct 2015 13:31:02 +0000 Received: from localhost ([127.0.0.1]:37912 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zlzeu-0006Bg-Vu for submit@debbugs.gnu.org; Tue, 13 Oct 2015 09:30:53 -0400 Received: from mailgw01.kcn.ne.jp ([61.86.7.208]:38176) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zlzeb-0006B6-Bz for 21670-done@debbugs.gnu.org; Tue, 13 Oct 2015 09:30:13 -0400 Received: from mxs01-s (mailgw1.kcn.ne.jp [61.86.15.233]) by mailgw01.kcn.ne.jp (Postfix) with ESMTP id 977528027F for <21670-done@debbugs.gnu.org>; Tue, 13 Oct 2015 22:30:06 +0900 (JST) X-matriXscan-loop-detect: ba6483660b127a65ff74978391beee29a52e744c Received: from mail04.kcn.ne.jp ([61.86.6.183]) by mxs01-s with ESMTP; Tue, 13 Oct 2015 22:30:04 +0900 (JST) Received: from [10.120.1.81] (i118-21-128-66.s30.a048.ap.plala.or.jp [118.21.128.66]) by mail04.kcn.ne.jp (Postfix) with ESMTPA id C63BD129009A; Tue, 13 Oct 2015 22:30:03 +0900 (JST) Date: Tue, 13 Oct 2015 22:30:03 +0900 From: Norihiro Tanaka To: Paul Eggert Subject: Re: bug#21670: surprising bug in grep -e with anchors In-Reply-To: <561B383D.6090403@cs.ucla.edu> References: <561B383D.6090403@cs.ucla.edu> Message-Id: <20151013222953.8D0B.27F6AC2D@kcn.ne.jp> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------_561D0283000000008D02_MULTIPART_MIXED_" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.65.07 [ja] X-matriXscan-Sophos-AV: Clean X-matriXscan-Action: Approve X-matriXscan: Uncategorized X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21670-done Cc: 21670-done@debbugs.gnu.org, greg boyd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --------_561D0283000000008D02_MULTIPART_MIXED_ Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit On Sun, 11 Oct 2015 21:34:05 -0700 Paul Eggert wrote: > greg boyd wrote: > > test case (single line) > > abchelloabc > > > > grep does not find the line with grep -e '^hello' nor with grep -e 'hello$' > > however, the line is output with > > grep -e '^hello' -e 'hello$' > > Oooo, that's a good one. Give your student extra credit! As it happens, the bug was recently fixed by this patch by Norihiro Tanaka: > > http://git.savannah.gnu.org/cgit/grep.git/commit/?id=256a4b494fe1c48083ba73b4f62607234e4fefd5 > > and the fix should appear in the next grep release. However, since the patch was supposed to affect only performance, it appears that the bug fix was due to luck, and I'm taking the liberty of adding your student's test case by installing the attached further patch, to help prevent this bug from coming back in a future version. I found above patch is also buggy. It is never fix. It returns shorter `must' than expected. e.g. `must' for pattern `.hello' is `hello', but returns `hell' by this bug. Next, `must' for pattern `^hello' is `hello' but returns `hell'. It will cause slite performance down, and disappear bug#21670, BTW, I guess the bug does not change external behavior. First patch fixes the bug. After the patch is applied, bug#21670 appears again. And, second patch fixes bug#21670. When pattern has ^ and/or $, if begline and/or endline flag of mp is turned off, EXACT should be false. --------_561D0283000000008D02_MULTIPART_MIXED_ Content-Type: text/plain; charset="US-ASCII"; name="0001-dfa-don-t-use-DFA-for-exact-matching.patch" Content-Disposition: attachment; filename="0001-dfa-don-t-use-DFA-for-exact-matching.patch" Content-Transfer-Encoding: base64 RnJvbSBkNGY4NmU2MmM4NTRmMzIzZmVjY2VhNzY4ODlkMjI5OGE1ZjMzNWQ0IE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBOb3JpaGlybyBUYW5ha2EgPG5vcml0bmtAa2NuLm5lLmpwPgpE YXRlOiBUdWUsIDEzIE9jdCAyMDE1IDExOjQzOjQ5ICswOTAwClN1YmplY3Q6IFtQQVRDSCAxLzJd IGRmYTogZG9uJ3QgdXNlIERGQSBmb3IgZXhhY3QgbWF0Y2hpbmcKCklmIGEgcGF0dGVybiBjb25z dHJhaW50IGJlZ2lubmluZyBvZiBsaW5lIGEgcGF0dGVybiwgREZBIGlzIHVzZWQgYWZ0ZXIKbWF0 Y2hlZCBpbiBLV3NldCwgZXZlbiB3aGVuIGl0IGlzIGV4YWN0LiAgVGhlIGJlaGF2aW9yIGlzIG5v dCBleHBlY3RlZC4KTm93LCB3aGVuZXZlciBhIHBhdHRlcm4gaXMgZXhhY3QsIERGQSBpcyBub3Qg dXNlZC4KCiogc3JjL2RmYS5jIChkZmFtdXN0KTogRG9uJ3QgdXNlIERGQSBmb3IgZXhhY3QgbWF0 Y2hpbmcuCi0tLQogc3JjL2RmYS5jIHwgMiArLQogMSBmaWxlIGNoYW5nZWQsIDEgaW5zZXJ0aW9u KCspLCAxIGRlbGV0aW9uKC0pCgpkaWZmIC0tZ2l0IGEvc3JjL2RmYS5jIGIvc3JjL2RmYS5jCmlu ZGV4IGFjNTEyOWIuLjViOWE0ZmUgMTAwNjQ0Ci0tLSBhL3NyYy9kZmEuYworKysgYi9zcmMvZGZh LmMKQEAgLTQxMzUsNyArNDEzNSw3IEBAIGRmYW11c3QgKHN0cnVjdCBkZmEgY29uc3QgKmQpCiAg ICAgICAgICAgICAgICAgPSBjYXNlX2ZvbGQgJiYgTUJfQ1VSX01BWCA9PSAxID8gdG91cHBlciAo dCkgOiB0OwogICAgICAgICAgICAgfQogICAgICAgICAgIG1wLT5pc1tpXSA9IG1wLT5sZWZ0W2ld ID0gbXAtPnJpZ2h0W2ldID0gJ1wwJzsKLSAgICAgICAgICBtcC0+aW4gPSBlbmxpc3QgKG1wLT5p biwgbXAtPmlzLCBpIC0gMSk7CisgICAgICAgICAgbXAtPmluID0gZW5saXN0IChtcC0+aW4sIG1w LT5pcywgaSk7CiAgICAgICAgICAgYnJlYWs7CiAgICAgICAgIH0KICAgICB9Ci0tIAoyLjQuMQoK --------_561D0283000000008D02_MULTIPART_MIXED_ Content-Type: text/plain; charset="US-ASCII"; name="0002-dfa-fix-bug-in-alternate-of-sub-patterns-different-i.patch" Content-Disposition: attachment; filename="0002-dfa-fix-bug-in-alternate-of-sub-patterns-different-i.patch" Content-Transfer-Encoding: base64 RnJvbSAzYmUwYmM1NTEzODc5MTFmYWY5OGQ4OWRjMDc2ZjM5NTYxYTc1M2YzIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBOb3JpaGlybyBUYW5ha2EgPG5vcml0bmtAa2NuLm5lLmpwPgpE YXRlOiBUdWUsIDEzIE9jdCAyMDE1IDAxOjE5OjQzICswOTAwClN1YmplY3Q6IFtQQVRDSCAyLzJd IGRmYTogZml4IGJ1ZyBpbiBhbHRlcm5hdGUgb2Ygc3ViLXBhdHRlcm5zIGRpZmZlcmVudCBpbgog b25seSB0aGUgY29uc3RyYWludHMKCkEgbGluZSBtYXkgaW5jb3JyZWN0bHkgbWF0Y2hlcyBhbHRl cm5hdGUgb2Ygc3ViLXBhdHRlcm5zIGRpZmZlcmVudCBpbgpvbmx5IHRoZSBjb25zdHJhaW50cyBl LmcuIF5hfGEkIGluIGV4dGVuZGVkIHJlZ3VsYXIgZXhwcmVzc2lvbi4gIFRoaXMKY2hhbmdlIGZp eGVzIHRoZSBidWcuICBSZXBvcnRlZCBieSBHcmVnIEJveWQgaW4KaHR0cDovL2RlYmJ1Z3MuZ251 Lm9yZy8yMTY3MAoKKiBzcmMvZGZhLmMgKGRmYW11c3QpOiBGb3IgYSBwYXR0ZXJuIHdpdGggY29u c3RyYWludHMsIGNoZWNrIHRoYXQgaXQgaXMKbWF0Y2hlZCBpbmNsdWRpbmcgdGhlIGNvbnN0cmFp bnRzLCB0byBqdWRnZSB3aGV0aGVyIGl0IGlzIGV4YWN0LgotLS0KIHNyYy9kZmEuYyB8IDggKysr KysrKy0KIDEgZmlsZSBjaGFuZ2VkLCA3IGluc2VydGlvbnMoKyksIDEgZGVsZXRpb24oLSkKCmRp ZmYgLS1naXQgYS9zcmMvZGZhLmMgYi9zcmMvZGZhLmMKaW5kZXggNWI5YTRmZS4uY2RlYTRlNSAx MDA2NDQKLS0tIGEvc3JjL2RmYS5jCisrKyBiL3NyYy9kZmEuYwpAQCAtMzk0MCw2ICszOTQwLDgg QEAgZGZhbXVzdCAoc3RydWN0IGRmYSBjb25zdCAqZCkKICAgYm9vbCBleGFjdCA9IGZhbHNlOwog ICBib29sIGJlZ2xpbmUgPSBmYWxzZTsKICAgYm9vbCBlbmRsaW5lID0gZmFsc2U7CisgIGJvb2wg bmVlZF9iZWdsaW5lID0gZmFsc2U7CisgIGJvb2wgbmVlZF9lbmRsaW5lID0gZmFsc2U7CiAKICAg Zm9yIChzaXplX3QgcmkgPSAwOyByaSA8IGQtPnRpbmRleDsgKytyaSkKICAgICB7CkBAIC0zOTQ5 LDEwICszOTUxLDEyIEBAIGRmYW11c3QgKHN0cnVjdCBkZmEgY29uc3QgKmQpCiAgICAgICAgIGNh c2UgQkVHTElORToKICAgICAgICAgICBtcCA9IGFsbG9jbXVzdCAobXAsIDIpOwogICAgICAgICAg IG1wLT5iZWdsaW5lID0gdHJ1ZTsKKyAgICAgICAgICBuZWVkX2JlZ2xpbmUgPSB0cnVlOwogICAg ICAgICAgIGJyZWFrOwogICAgICAgICBjYXNlIEVORExJTkU6CiAgICAgICAgICAgbXAgPSBhbGxv Y211c3QgKG1wLCAyKTsKICAgICAgICAgICBtcC0+ZW5kbGluZSA9IHRydWU7CisgICAgICAgICAg bmVlZF9lbmRsaW5lID0gdHJ1ZTsKICAgICAgICAgICBicmVhazsKICAgICAgICAgY2FzZSBMUEFS RU46CiAgICAgICAgIGNhc2UgUlBBUkVOOgpAQCAtNDAyOSw3ICs0MDMzLDkgQEAgZGZhbXVzdCAo c3RydWN0IGRmYSBjb25zdCAqZCkKICAgICAgICAgICAgICAgcmVzdWx0ID0gbXAtPmluW2ldOwog ICAgICAgICAgIGlmIChTVFJFUSAocmVzdWx0LCBtcC0+aXMpKQogICAgICAgICAgICAgewotICAg ICAgICAgICAgICBleGFjdCA9IHRydWU7CisgICAgICAgICAgICAgIGlmICgoIW5lZWRfYmVnbGlu ZSB8fCBtcC0+YmVnbGluZSkgJiYgKCFuZWVkX2VuZGxpbmUKKyAgICAgICAgICAgICAgICAgICAg ICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfHwgbXAtPmVuZGxpbmUpKQorICAgICAg ICAgICAgICAgIGV4YWN0ID0gdHJ1ZTsKICAgICAgICAgICAgICAgYmVnbGluZSA9IG1wLT5iZWds aW5lOwogICAgICAgICAgICAgICBlbmRsaW5lID0gbXAtPmVuZGxpbmU7CiAgICAgICAgICAgICB9 Ci0tIAoyLjQuMQoK --------_561D0283000000008D02_MULTIPART_MIXED_-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 13 18:31:33 2015 Received: (at 21670) by debbugs.gnu.org; 13 Oct 2015 22:31:33 +0000 Received: from localhost ([127.0.0.1]:39161 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm86W-0003q4-ME for submit@debbugs.gnu.org; Tue, 13 Oct 2015 18:31:33 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:42710) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zm86U-0003mv-6c for 21670@debbugs.gnu.org; Tue, 13 Oct 2015 18:31:31 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 22F261607CC; Tue, 13 Oct 2015 15:31:29 -0700 (PDT) Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id k2OBMfiEphDC; Tue, 13 Oct 2015 15:31:28 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 5C280160D68; Tue, 13 Oct 2015 15:31:28 -0700 (PDT) X-Virus-Scanned: amavisd-new at zimbra.cs.ucla.edu Received: from zimbra.cs.ucla.edu ([127.0.0.1]) by localhost (zimbra.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id zWZLYYm2u2Qd; Tue, 13 Oct 2015 15:31:28 -0700 (PDT) Received: from Penguin.CS.UCLA.EDU (Penguin.CS.UCLA.EDU [131.179.64.200]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3D1D61607CC; Tue, 13 Oct 2015 15:31:28 -0700 (PDT) Subject: Re: bug#21670: surprising bug in grep -e with anchors To: Norihiro Tanaka References: <561B383D.6090403@cs.ucla.edu> <20151013222953.8D0B.27F6AC2D@kcn.ne.jp> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: <561D8640.7080209@cs.ucla.edu> Date: Tue, 13 Oct 2015 15:31:28 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20151013222953.8D0B.27F6AC2D@kcn.ne.jp> Content-Type: multipart/mixed; boundary="------------030509050906050303000900" X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 21670 Cc: 21670@debbugs.gnu.org, greg boyd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.0 (/) This is a multi-part message in MIME format. --------------030509050906050303000900 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 10/13/2015 06:30 AM, Norihiro Tanaka wrote: > First patch fixes the bug. After the patch is applied, bug#21670 > appears again. And, second patch fixes bug#21670. Thanks, I installed both of them after rewording the commit logs a bit, along with the attached minor further improvement. --------------030509050906050303000900 Content-Type: text/x-patch; name="0001-dfa-make-the-executable-a-bit-smaller.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-dfa-make-the-executable-a-bit-smaller.patch" >From f7a45f7f48c0e1cdd498ec44f462179e57d48640 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 13 Oct 2015 15:26:38 -0700 Subject: [PATCH] dfa: make the executable a bit smaller * src/dfa.c (dfamust): Hoist MB_CUR_MAX calculation out of loops. --- src/dfa.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/dfa.c b/src/dfa.c index cdea4e5..c1a00f8 100644 --- a/src/dfa.c +++ b/src/dfa.c @@ -3942,6 +3942,7 @@ dfamust (struct dfa const *d) bool endline = false; bool need_begline = false; bool need_endline = false; + bool case_fold_unibyte = case_fold && MB_CUR_MAX == 1; for (size_t ri = 0; ri < d->tindex; ++ri) { @@ -4108,7 +4109,7 @@ dfamust (struct dfa const *d) t = j; while (++j < NOTCHAR) if (tstbit (j, *ccl) - && ! (case_fold && MB_CUR_MAX == 1 + && ! (case_fold_unibyte && toupper (j) == toupper (t))) break; if (j < NOTCHAR) @@ -4131,14 +4132,14 @@ dfamust (struct dfa const *d) } mp = allocmust (mp, ((rj - ri) >> 1) + 1); mp->is[0] = mp->left[0] = mp->right[0] - = case_fold && MB_CUR_MAX == 1 ? toupper (t) : t; + = case_fold_unibyte ? toupper (t) : t; for (i = 1; ri + 2 < rj; i++) { ri += 2; t = d->tokens[ri]; mp->is[i] = mp->left[i] = mp->right[i] - = case_fold && MB_CUR_MAX == 1 ? toupper (t) : t; + = case_fold_unibyte ? toupper (t) : t; } mp->is[i] = mp->left[i] = mp->right[i] = '\0'; mp->in = enlist (mp->in, mp->is, i); -- 2.1.0 --------------030509050906050303000900-- From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 13 21:43:43 2015 Received: (at 21670) by debbugs.gnu.org; 14 Oct 2015 01:43:43 +0000 Received: from localhost ([127.0.0.1]:39226 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZmB6V-0002Vj-3p for submit@debbugs.gnu.org; Tue, 13 Oct 2015 21:43:43 -0400 Received: from mail-io0-f172.google.com ([209.85.223.172]:36293) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZmB6R-0002VY-IH for 21670@debbugs.gnu.org; Tue, 13 Oct 2015 21:43:40 -0400 Received: by ioii196 with SMTP id i196so40551573ioi.3 for <21670@debbugs.gnu.org>; Tue, 13 Oct 2015 18:43:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=1dsoHXbHkbc6tiwBLE0UK5d+sC5oRS8S7oIchgRA/Z0=; b=fah2VDh9ttMdfytD/9Jw0vepu0iLM9rrj+pJODefvM5v29tSGZQCTx2uswGrDQ1Kck fLVr197A4Ah0qU5cmzHJMKJhZaceWtttUdeP/6dV8eN5A6BEhhwlJ18e2TprGneeSg3O 5hfOtQ7FNupAik6Rpr/BcQvdJCX9F8w+CtOAVmRIDvrLITzCS24Q4VNakxjXl4QI+3FL b6FVWSyhIOYk2GpRBjmXYp/jZrsLO4XVLLLh1fMtRR0e6Lh2NPHHx73jT8uZf0uRS9o2 hSZjw4hM9/FbPW+/MXXu5V5QRAwBCXDpy+6/aTKcbtZeQuEeM9GZxQVnGWsW36BLKh1U lDPQ== X-Received: by 10.107.166.79 with SMTP id p76mr982948ioe.163.1444787018839; Tue, 13 Oct 2015 18:43:38 -0700 (PDT) MIME-Version: 1.0 Received: by 10.36.10.66 with HTTP; Tue, 13 Oct 2015 18:43:18 -0700 (PDT) In-Reply-To: <561D8640.7080209@cs.ucla.edu> References: <561B383D.6090403@cs.ucla.edu> <20151013222953.8D0B.27F6AC2D@kcn.ne.jp> <561D8640.7080209@cs.ucla.edu> From: Jim Meyering Date: Tue, 13 Oct 2015 18:43:18 -0700 X-Google-Sender-Auth: eJ_VUmro5ZA3-4VgHglNAMqQByo Message-ID: Subject: Re: bug#21670: surprising bug in grep -e with anchors To: Paul Eggert Content-Type: text/plain; charset=UTF-8 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21670 Cc: greg boyd , Norihiro Tanaka , 21670@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, Oct 13, 2015 at 3:31 PM, Paul Eggert wrote: > On 10/13/2015 06:30 AM, Norihiro Tanaka wrote: >> >> First patch fixes the bug. After the patch is applied, bug#21670 >> appears again. And, second patch fixes bug#21670. > > Thanks, I installed both of them after rewording the commit logs a bit, > along with the attached minor further improvement. Thank you, Paul. From debbugs-submit-bounces@debbugs.gnu.org Wed Oct 14 11:01:11 2015 Received: (at 21670) by debbugs.gnu.org; 14 Oct 2015 15:01:11 +0000 Received: from localhost ([127.0.0.1]:40410 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZmNYF-0001qZ-4L for submit@debbugs.gnu.org; Wed, 14 Oct 2015 11:01:11 -0400 Received: from mailgw06.kcn.ne.jp ([61.86.7.213]:41369) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZmNYC-0001qO-2I for 21670@debbugs.gnu.org; Wed, 14 Oct 2015 11:01:09 -0400 Received: from mxs02-s (mailgw2.kcn.ne.jp [61.86.15.234]) by mailgw06.kcn.ne.jp (Postfix) with ESMTP id ACF68E80607 for <21670@debbugs.gnu.org>; Thu, 15 Oct 2015 00:01:05 +0900 (JST) X-matriXscan-loop-detect: 5577c2c01f7134ebd0bb67a546fb832ff3f7155d Received: from mail04.kcn.ne.jp ([61.86.6.183]) by mxs02-s with ESMTP; Thu, 15 Oct 2015 00:01:03 +0900 (JST) Received: from [10.120.1.85] (i118-21-128-66.s30.a048.ap.plala.or.jp [118.21.128.66]) by mail04.kcn.ne.jp (Postfix) with ESMTPA id 91BAF1290022; Thu, 15 Oct 2015 00:01:03 +0900 (JST) Date: Thu, 15 Oct 2015 00:01:03 +0900 From: Norihiro Tanaka To: Paul Eggert Subject: Re: bug#21670: surprising bug in grep -e with anchors In-Reply-To: <561D8640.7080209@cs.ucla.edu> References: <20151013222953.8D0B.27F6AC2D@kcn.ne.jp> <561D8640.7080209@cs.ucla.edu> Message-Id: <20151015000102.8BA4.27F6AC2D@kcn.ne.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Mailer: Becky! ver. 2.65.07 [ja] X-matriXscan-Sophos-AV: Clean X-matriXscan-Action: Approve X-matriXscan: Uncategorized X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21670 Cc: 21670@debbugs.gnu.org, greg boyd X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) On Tue, 13 Oct 2015 15:31:28 -0700 Paul Eggert wrote: > On 10/13/2015 06:30 AM, Norihiro Tanaka wrote: > > First patch fixes the bug. After the patch is applied, bug#21670 > > appears again. And, second patch fixes bug#21670. > Thanks, I installed both of them after rewording the commit logs a bit, along with the attached minor further improvement. Thanks for review and rewording. From debbugs-submit-bounces@debbugs.gnu.org Tue Oct 27 20:38:09 2015 Received: (at 21670) by debbugs.gnu.org; 28 Oct 2015 00:38:09 +0000 Received: from localhost ([127.0.0.1]:40989 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrEkj-0000EP-37 for submit@debbugs.gnu.org; Tue, 27 Oct 2015 20:38:09 -0400 Received: from mail-vk0-f53.google.com ([209.85.213.53]:33625) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrEkg-0000EH-QW for 21670@debbugs.gnu.org; Tue, 27 Oct 2015 20:38:07 -0400 Received: by vkgy127 with SMTP id y127so133000099vkg.0 for <21670@debbugs.gnu.org>; Tue, 27 Oct 2015 17:38:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=WZR7tD455jC1D6LdF2XtFEB2hUx4+4C72z8QIiOJj80=; b=cBxRK5Xi+mhvLzGXzhtlza4tI3O8PNUqiDof/rfOe9HNOplmwGVnjBTlncm5ZDSaJU UDwH1mjU9CkiYQxjNA/+ALEUuN60OHR5NToHLxJHISamLBEyJA6MdnWsebcS7i9sLxs5 Qzv5Tj3u4FHX9odMSRkvrGCLz6WynIRamseZsQL4Mrpe9djDp30KzK1pNoIe+UE8Csg2 3oIuByHH1Rveodxowlxu+HKWhpT++HxkaKFl56Sp8xGC5z9D/XSOebId0vC3ob8kbw+g 38Z2e2jtiCVT3tbZFe7s6MkfKR8WBSWQA9h2QuUNPcT3BEvKcjR4dklOr6ArUFCeqzZP FhsQ== X-Received: by 10.31.8.4 with SMTP id 4mr31394098vki.77.1445992686265; Tue, 27 Oct 2015 17:38:06 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.65.11 with HTTP; Tue, 27 Oct 2015 17:37:46 -0700 (PDT) In-Reply-To: References: From: Jim Meyering Date: Tue, 27 Oct 2015 17:37:46 -0700 X-Google-Sender-Auth: mCckTQWqT7PDG2lF4xGz0RDTYH0 Message-ID: Subject: Re: bug#21670: surprising bug in grep -e with anchors To: greg boyd , drakewang@gmail.com Content-Type: multipart/mixed; boundary=001a1144102a69d5cf05231f6857 X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 21670 Cc: 21670@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.7 (/) --001a1144102a69d5cf05231f6857 Content-Type: text/plain; charset=UTF-8 On Sun, Oct 11, 2015 at 2:01 PM, greg boyd wrote: > This bug appears in GNU grep version 2.20. It is not present in the older > version I have installed on a home system (2.6.3.) > > test case (single line) > abchelloabc > > grep does not find the line with grep -e '^hello' nor with grep -e 'hello$' > however, the line is output with > grep -e '^hello' -e 'hello$' > > I downloaded, built and tested the bug on GNU grep 2.21 and it still > appears. > > weird. > > (this was found by an introductory Linux student. ) I asked Greg for the student's name and then added two names to THANKS.in with this: --001a1144102a69d5cf05231f6857 Content-Type: text/x-patch; charset=UTF-8; name="0001-maint-update-THANKS.in.patch" Content-Disposition: attachment; filename="0001-maint-update-THANKS.in.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_iga2o2c30 RnJvbSBkYTljZjQ3ZTI3NjkwNTM1NzZkYWYxZTI5OThhMzliYzk4ODVjMjdkIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBKaW0gTWV5ZXJpbmcgPG1leWVyaW5nQGZiLmNvbT4KRGF0ZTog TW9uLCAyNiBPY3QgMjAxNSAyMTowMDoxMSAtMDcwMApTdWJqZWN0OiBbUEFUQ0hdIG1haW50OiB1 cGRhdGUgVEhBTktTLmluCgoqIFRIQU5LUy5pbjogQWRkIG5hbWUrZW1haWwgb2YgdGhvc2Ugd2hv IGZvdW5kIGFuZCByZXBvcnRlZAp0aGUgYnVnIHRoYXQgbWFkZSBncmVwIC1FICdeeHx4JCcgbWF0 Y2ggYW55ICJ4Ii4KLS0tCiBUSEFOS1MuaW4gfCAyICsrCiAxIGZpbGUgY2hhbmdlZCwgMiBpbnNl cnRpb25zKCspCgpkaWZmIC0tZ2l0IGEvVEhBTktTLmluIGIvVEhBTktTLmluCmluZGV4IDYyNDQ3 OGQuLmI4NmY3NzIgMTAwNjQ0Ci0tLSBhL1RIQU5LUy5pbgorKysgYi9USEFOS1MuaW4KQEAgLTI1 LDEyICsyNSwxNCBAQCBEYXZlIFJlaXNuZXIgICAgICAgICAgICAgICAgICAgICAgICBkQGZhbGNv bmluZHkuY29tCiBEYXZpZCBDbGlzc29sZCAgICAgICAgICAgICAgICAgICAgICBjbGlzc0BhdXN0 aW4uaWJtLmNvbQogRGF2aWQgSiBNYWNLZW56aWUgICAgICAgICAgICAgICAgICAgZGptQGNhdGFw dWx0LnZhLnB1Ym5peC5jb20KIERhdmlkIE8nQnJpZW4gICAgICAgICAgICAgICAgICAgICAgIG9i cmllbkBmcmVlYnNkLm9yZworJ0RyYWtlJyBEYWhhbSBXYW5nICAgICAgICAgICAgICAgICAgZHJh a2V3YW5nQGdtYWlsLmNvbQogRWdtb250IEtvYmxpbmdlciAgICAgICAgICAgICAgICAgICAgZWdt b250QGdtYWlsLmNvbQogRmVybmFuZG8gQmFzc28gICAgICAgICAgICAgICAgICAgICAgZmVybmFu ZG9iYXNzby5ickBnbWFpbC5jb20KIEZsb3JpYW4gTGEgUm9jaGUgICAgICAgICAgICAgICAgICAg IGxhcm9jaGVAcmVkaGF0LmNvbQogRnJhbsOnb2lzIFBpbmFyZCAgICAgICAgICAgICAgICAgICAg IHBpbmFyZEBpcm8udW1vbnRyZWFsLmNhCiBHZXJhbGQgU3RvbGxlciAgICAgICAgICAgICAgICAg ICAgICBnZXJhbGRfc3RvbGxlckBob3RtYWlsLmNvbQogR3JhbnQgTWNEb3JtYW4gICAgICAgICAg ICAgICAgICAgICAgZ3JhbnRAaXNndGVjLmNvbQorR3JlZyBCb3lkICAgICAgICAgICAgICAgICAg ICAgICAgICAgZ2JveWQuY2NzZkBnbWFpbC5jb20KIEdyZWcgTG91aXMgICAgICAgICAgICAgICAg ICAgICAgICAgIGdsb3Vpc0BkeW5hbWljcm8ub24uY2EKIEd1Z2xpZWxtbyAnYm9uZCcgQm9uZGlv bmkgICAgICAgICAgIGcuYm9uZGlvbmlAbGliZXJvLml0CiBILiBNZXJpam4gQnJhbmQgICAgICAg ICAgICAgICAgICAgICBoLm0uYnJhbmRAaGNjbmV0Lm5sCi0tIAoyLjYuMAoK --001a1144102a69d5cf05231f6857-- From unknown Tue Jun 17 01:28:33 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 25 Nov 2015 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator