From unknown Sat Aug 16 18:20:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24024: grep: Mixing "max-count" and "after-context" outputs too few lines Resent-From: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Tue, 19 Jul 2016 11:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 24024 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: ygrex@ygrex.ru, 831673@bugs.debian.org, 24024@debbugs.gnu.org X-Debbugs-Original-To: Igor Bogomazov , 831673@bugs.debian.org, bug-grep Received: via spool by submit@debbugs.gnu.org id=B.146892925012977 (code B ref -1); Tue, 19 Jul 2016 11:55:01 +0000 Received: (at submit) by debbugs.gnu.org; 19 Jul 2016 11:54:10 +0000 Received: from localhost ([127.0.0.1]:56526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPTbG-0003NF-75 for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:54:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPTbB-0003MZ-T5 for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:54:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTb4-0005A7-88 for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:53:59 -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,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTb4-0005A3-4t for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:53:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTb1-0002it-P1 for bug-grep@gnu.org; Tue, 19 Jul 2016 07:53:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTax-00059R-GU for bug-grep@gnu.org; Tue, 19 Jul 2016 07:53:55 -0400 Received: from mx1.riseup.net ([198.252.153.129]:33260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTax-00059K-7S for bug-grep@gnu.org; Tue, 19 Jul 2016 07:53:51 -0400 Received: from cotinga.riseup.net (unknown [10.0.1.164]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id A965D1A1D20; Tue, 19 Jul 2016 11:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1468929229; bh=/mf5Uj5kUDzCUdCDPFvwVpCaZLIRBGXQY62lC3jX6gc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=TdufgOWWqSMFjLXfKpk/zd/uZmC4WYi7M0F+jAc2h6nV3jFepOz2ZcfAmEvh7dzV2 o5CMPoINqyqrbhSO1jsNXQpZqRlUE5+Fmug4HCpnMQOIKpdICI+lMM1Ea1Px80P2ib YVlDccsbNC0YcZrp9jUtZDwDJbu99orITKuGy27s= Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: santiagorr) with ESMTPSA id AD51140364 Received: by nomada (sSMTP sendmail emulation); Tue, 19 Jul 2016 13:53:45 +0200 Date: Tue, 19 Jul 2016 13:53:45 +0200 From: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Message-ID: <20160719115345.GE8786@riseup.net> References: <20160718143025.45b24734@ygrex-t550.ygrex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20160718143025.45b24734@ygrex-t550.ygrex.ru> X-Virus-Scanned: clamav-milter 0.99.2 at mx1.riseup.net X-Virus-Status: Clean Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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.1 (----) Hi, Igor Bogomazov filed the following bug against grep in Debian. El 18/07/16 a las 14:30, Igor Bogomazov escribi=F3: > Package: grep > Version: 2.25-6 > Severity: normal >=20 >=20 > Given after-context=3D3 it is expected to output at least 4 lines > as documented, but adding max-count=3D1 makes it stop on the next > matching line. >=20 > What I do: >=20 > $ printf '%s\n' a b a c | grep -m1 -A3 a >=20 > What I see: >=20 > a > b >=20 > What I expect: >=20 > a > b > a > c >=20 > -- System Information: > Debian Release: stretch/sid > APT prefers unstable > APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable') > Architecture: amd64 (x86_64) >=20 > Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores) > Locale: LANG=3Den_US.UTF-8, LC_CTYPE=3Den_US.UTF-8 (charmap=3DUTF-8) > Shell: /bin/sh linked to /bin/dash > Init: systemd (via /run/systemd/system) >=20 > Versions of packages grep depends on: > ii dpkg 1.18.9 > ii install-info 6.1.0.dfsg.1-8 > ii libc6 2.23-1 > ii libpcre3 2:8.38-3.1 >=20 > grep recommends no packages. >=20 > Versions of packages grep suggests: > ii libpcre3 2:8.38-3.1 >=20 > -- no debconf information >=20 Note also the behavior when there is not a second match: % printf '%s\n' a b d c | grep -m1 -A3 a a b d c Cheers, Santiago From unknown Sat Aug 16 18:20:37 2025 X-Loop: help-debbugs@gnu.org Subject: bug#24024: grep: Mixing "max-count" and "after-context" outputs too few lines Resent-From: Norihiro Tanaka Original-Sender: "Debbugs-submit" Resent-CC: bug-grep@gnu.org Resent-Date: Tue, 26 Jul 2016 15:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 24024 X-GNU-PR-Package: grep X-GNU-PR-Keywords: To: Santiago Ruano Rincon Cc: 24024@debbugs.gnu.org, 831673@bugs.debian.org, ygrex@ygrex.ru Received: via spool by 24024-submit@debbugs.gnu.org id=B24024.146954749532645 (code B ref 24024); Tue, 26 Jul 2016 15:39:02 +0000 Received: (at 24024) by debbugs.gnu.org; 26 Jul 2016 15:38:15 +0000 Received: from localhost ([127.0.0.1]:38293 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bS4Qt-0008UP-Hd for submit@debbugs.gnu.org; Tue, 26 Jul 2016 11:38:15 -0400 Received: from mailgw05.kcn.ne.jp ([61.86.7.212]:48532) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bS4Qo-0008Tq-V5 for 24024@debbugs.gnu.org; Tue, 26 Jul 2016 11:38:10 -0400 Received: from mxs01-s (mailgw1.kcn.ne.jp [61.86.15.233]) by mailgw05.kcn.ne.jp (Postfix) with ESMTP id 13ADD880687 for <24024@debbugs.gnu.org>; Wed, 27 Jul 2016 00:37:59 +0900 (JST) X-matriXscan-loop-detect: 573d3a78421e986a8b3f972edc1a4ed9b7e3e4ac Received: from mail05.kcn.ne.jp ([61.86.6.184]) by mxs01-s with ESMTP; Wed, 27 Jul 2016 00:37:56 +0900 (JST) Received: from [10.120.1.66] (i118-21-128-66.s30.a048.ap.plala.or.jp [118.21.128.66]) by mail05.kcn.ne.jp (Postfix) with ESMTPA id 6E0627D0099; Wed, 27 Jul 2016 00:37:56 +0900 (JST) Date: Wed, 27 Jul 2016 00:38:02 +0900 From: Norihiro Tanaka In-Reply-To: <20160719115345.GE8786@riseup.net> References: <20160718143025.45b24734@ygrex-t550.ygrex.ru> <20160719115345.GE8786@riseup.net> Message-Id: <20160727003801.5F4C.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: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -1.3 (-) > Igor Bogomazov filed the following bug against grep in > Debian. > > > $ printf '%s\n' a b a c | grep -m1 -A3 a > > > > What I see: > > > > a > > b > > > > What I expect: > > > > a > > b > > a > > c As long as looking at prepending(), I see that it is designed but not documented. From unknown Sat Aug 16 18:20:37 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Santiago Ruano =?UTF-8?Q?Rinc=C3=B3n?= Subject: bug#24024: closed (Re: bug#24024: grep: Mixing "max-count" and "after-context" outputs too few lines) Message-ID: References: <20160719115345.GE8786@riseup.net> X-Gnu-PR-Message: they-closed 24024 X-Gnu-PR-Package: grep Reply-To: 24024@debbugs.gnu.org Date: Thu, 08 Sep 2016 05:26:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1473312362-18248-1" This is a multi-part message in MIME format... ------------=_1473312362-18248-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #24024: grep: Mixing "max-count" and "after-context" outputs too few lines which was filed against the grep package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 24024@debbugs.gnu.org. --=20 24024: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D24024 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1473312362-18248-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 24024-done) by debbugs.gnu.org; 8 Sep 2016 05:25:13 +0000 Received: from localhost ([127.0.0.1]:53114 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhrpo-0004jD-SW for submit@debbugs.gnu.org; Thu, 08 Sep 2016 01:25:13 -0400 Received: from zimbra.cs.ucla.edu ([131.179.128.68]:48834) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bhrpm-0004j1-LM for 24024-done@debbugs.gnu.org; Thu, 08 Sep 2016 01:25:11 -0400 Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 3C19E161123; Wed, 7 Sep 2016 22:25:04 -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 GKyiuMzfd9_V; Wed, 7 Sep 2016 22:25:03 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by zimbra.cs.ucla.edu (Postfix) with ESMTP id 69DFF161169; Wed, 7 Sep 2016 22:25:03 -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 A74RVUFm2V2A; Wed, 7 Sep 2016 22:25:03 -0700 (PDT) Received: from [192.168.1.9] (unknown [100.32.155.148]) by zimbra.cs.ucla.edu (Postfix) with ESMTPSA id 3E031161123; Wed, 7 Sep 2016 22:25:03 -0700 (PDT) Subject: Re: bug#24024: grep: Mixing "max-count" and "after-context" outputs too few lines To: =?UTF-8?Q?Santiago_Ruano_Rinc=c3=b3n?= References: <20160718143025.45b24734@ygrex-t550.ygrex.ru> <20160719115345.GE8786@riseup.net> From: Paul Eggert Organization: UCLA Computer Science Department Message-ID: Date: Wed, 7 Sep 2016 22:25:03 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: <20160719115345.GE8786@riseup.net> Content-Type: multipart/mixed; boundary="------------888D77C071BCDC7A8E09FE99" X-Spam-Score: -1.1 (-) X-Debbugs-Envelope-To: 24024-done Cc: Norihiro Tanaka , 831673@bugs.debian.org, 24024-done@debbugs.gnu.org, ygrex@ygrex.ru X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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: -1.1 (-) This is a multi-part message in MIME format. --------------888D77C071BCDC7A8E09FE99 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable >> Given after-context=3D3 it is expected to output at least 4 lines >> as documented, but adding max-count=3D1 makes it stop on the next >> matching line. Thanks for reporting this. Although grep's behavior is documented ("conte= xt does=20 not include matching lines" in the node General Output Control) the=20 documentation could be clearer and I installed the attached patch. --------------888D77C071BCDC7A8E09FE99 Content-Type: text/plain; charset=UTF-8; name="0001-doc-define-context-lines.txt" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="0001-doc-define-context-lines.txt" RnJvbSA5MGEyZGQ4YjdmOTNlZjBhOGYwODc0MWU2ZmNiMDcyMjBmOTU0OWY2IE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBXZWQsIDcgU2VwIDIwMTYgMjI6MjI6MzcgLTA3MDAKU3ViamVjdDogW1BBVENI XSBkb2M6IGRlZmluZSAiY29udGV4dCBsaW5lcyIKTUlNRS1WZXJzaW9uOiAxLjAKQ29udGVu dC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVURi04CkNvbnRlbnQtVHJhbnNmZXItRW5j b2Rpbmc6IDhiaXQKClJlcG9ydGVkIGJ5IElnb3IgQm9nb21hem92IHZpYSBTYW50aWFnbyBS dWFubyBSaW5jw7NuIChCdWcjMjQwMjQpLgoqIGRvYy9ncmVwLnRleGkgKENvbnRleHQgTGlu ZSBDb250cm9sKTogRGVmaW5lICJjb250ZXh0IGxpbmVzIi4KLS0tCiBkb2MvZ3JlcC50ZXhp IHwgOCArKysrKystLQogMSBmaWxlIGNoYW5nZWQsIDYgaW5zZXJ0aW9ucygrKSwgMiBkZWxl dGlvbnMoLSkKCmRpZmYgLS1naXQgYS9kb2MvZ3JlcC50ZXhpIGIvZG9jL2dyZXAudGV4aQpp bmRleCA4MDc2OGRkLi43ZTUxZDQ1IDEwMDY0NAotLS0gYS9kb2MvZ3JlcC50ZXhpCisrKyBi L2RvYy9ncmVwLnRleGkKQEAgLTMzOCw2ICszMzgsNyBAQCBkbwogZG9uZQogQGVuZCBleGFt cGxlCiAKK0BjaW5kZXggY29udGV4dCBsaW5lcwogV2hlbiBAY29tbWFuZHtncmVwfSBzdG9w cyBhZnRlciBAdmFye251bX0gbWF0Y2hpbmcgbGluZXMsCiBpdCBvdXRwdXRzIGFueSB0cmFp bGluZyBjb250ZXh0IGxpbmVzLgogU2luY2UgY29udGV4dCBkb2VzIG5vdCBpbmNsdWRlIG1h dGNoaW5nIGxpbmVzLApAQCAtNTAxLDggKzUwMiwxMSBAQCBldmVuIHRob3NlIHRoYXQgY29u dGFpbiBuZXdsaW5lIGNoYXJhY3RlcnMuCiBAbm9kZSBDb250ZXh0IExpbmUgQ29udHJvbAog QHN1YnNlY3Rpb24gQ29udGV4dCBMaW5lIENvbnRyb2wKIAorQGNpbmRleCBjb250ZXh0IGxp bmVzCitAZGZue0NvbnRleHQgbGluZXN9IGFyZSBub24tbWF0Y2hpbmcgbGluZXMgdGhhdCBh cmUgbmVhciBhIG1hdGNoaW5nIGxpbmUuCitUaGV5IGFyZSBvdXRwdXQgb25seSBpZiBvbmUg b2YgdGhlIGZvbGxvd2luZyBvcHRpb25zIGFyZSB1c2VkLgogUmVnYXJkbGVzcyBvZiBob3cg dGhlc2Ugb3B0aW9ucyBhcmUgc2V0LAotQGNvbW1hbmR7Z3JlcH0gd2lsbCBuZXZlciBwcmlu dCBhbnkgZ2l2ZW4gbGluZSBtb3JlIHRoYW4gb25jZS4KK0Bjb21tYW5ke2dyZXB9IG5ldmVy IG91dHB1dHMgYW55IGdpdmVuIGxpbmUgbW9yZSB0aGFuIG9uY2UuCiBJZiB0aGUgQG9wdGlv bnstb30gKEBvcHRpb257LS1vbmx5LW1hdGNoaW5nfSkgb3B0aW9uIGlzIHNwZWNpZmllZCwK IHRoZXNlIG9wdGlvbnMgaGF2ZSBubyBlZmZlY3QgYW5kIGEgd2FybmluZyBpcyBnaXZlbiB1 cG9uIHRoZWlyIHVzZS4KIApAQCAtNTMwLDcgKzUzNCw3IEBAIFByaW50IEB2YXJ7bnVtfSBs aW5lcyBvZiBsZWFkaW5nIGNvbnRleHQgYmVmb3JlIG1hdGNoaW5nIGxpbmVzLgogQG9waW5k ZXggLUMKIEBvcGluZGV4IC0tY29udGV4dAogQG9waW5kZXggLUB2YXJ7bnVtfQotQGNpbmRl eCBjb250ZXh0CitAY2luZGV4IGNvbnRleHQgbGluZXMKIFByaW50IEB2YXJ7bnVtfSBsaW5l cyBvZiBsZWFkaW5nIGFuZCB0cmFpbGluZyBvdXRwdXQgY29udGV4dC4KIAogQGl0ZW0gLS1n cm91cC1zZXBhcmF0b3I9QHZhcntzdHJpbmd9Ci0tIAoyLjcuNAoK --------------888D77C071BCDC7A8E09FE99-- ------------=_1473312362-18248-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Jul 2016 11:54:10 +0000 Received: from localhost ([127.0.0.1]:56526 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPTbG-0003NF-75 for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:54:10 -0400 Received: from eggs.gnu.org ([208.118.235.92]:34783) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bPTbB-0003MZ-T5 for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:54:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTb4-0005A7-88 for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:53:59 -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,T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:55046) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTb4-0005A3-4t for submit@debbugs.gnu.org; Tue, 19 Jul 2016 07:53:58 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTb1-0002it-P1 for bug-grep@gnu.org; Tue, 19 Jul 2016 07:53:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bPTax-00059R-GU for bug-grep@gnu.org; Tue, 19 Jul 2016 07:53:55 -0400 Received: from mx1.riseup.net ([198.252.153.129]:33260) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bPTax-00059K-7S for bug-grep@gnu.org; Tue, 19 Jul 2016 07:53:51 -0400 Received: from cotinga.riseup.net (unknown [10.0.1.164]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id A965D1A1D20; Tue, 19 Jul 2016 11:53:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1468929229; bh=/mf5Uj5kUDzCUdCDPFvwVpCaZLIRBGXQY62lC3jX6gc=; h=Date:From:To:Subject:References:In-Reply-To:From; b=TdufgOWWqSMFjLXfKpk/zd/uZmC4WYi7M0F+jAc2h6nV3jFepOz2ZcfAmEvh7dzV2 o5CMPoINqyqrbhSO1jsNXQpZqRlUE5+Fmug4HCpnMQOIKpdICI+lMM1Ea1Px80P2ib YVlDccsbNC0YcZrp9jUtZDwDJbu99orITKuGy27s= Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: santiagorr) with ESMTPSA id AD51140364 Received: by nomada (sSMTP sendmail emulation); Tue, 19 Jul 2016 13:53:45 +0200 Date: Tue, 19 Jul 2016 13:53:45 +0200 From: Santiago Ruano =?iso-8859-1?Q?Rinc=F3n?= To: Igor Bogomazov , 831673@bugs.debian.org, bug-grep Subject: grep: Mixing "max-count" and "after-context" outputs too few lines Message-ID: <20160719115345.GE8786@riseup.net> References: <20160718143025.45b24734@ygrex-t550.ygrex.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: <20160718143025.45b24734@ygrex-t550.ygrex.ru> X-Virus-Scanned: clamav-milter 0.99.2 at mx1.riseup.net X-Virus-Status: Clean Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -4.1 (----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 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.1 (----) Hi, Igor Bogomazov filed the following bug against grep in Debian. El 18/07/16 a las 14:30, Igor Bogomazov escribi=F3: > Package: grep > Version: 2.25-6 > Severity: normal >=20 >=20 > Given after-context=3D3 it is expected to output at least 4 lines > as documented, but adding max-count=3D1 makes it stop on the next > matching line. >=20 > What I do: >=20 > $ printf '%s\n' a b a c | grep -m1 -A3 a >=20 > What I see: >=20 > a > b >=20 > What I expect: >=20 > a > b > a > c >=20 > -- System Information: > Debian Release: stretch/sid > APT prefers unstable > APT policy: (500, 'unstable'), (500, 'testing'), (500, 'stable') > Architecture: amd64 (x86_64) >=20 > Kernel: Linux 4.6.0-1-amd64 (SMP w/4 CPU cores) > Locale: LANG=3Den_US.UTF-8, LC_CTYPE=3Den_US.UTF-8 (charmap=3DUTF-8) > Shell: /bin/sh linked to /bin/dash > Init: systemd (via /run/systemd/system) >=20 > Versions of packages grep depends on: > ii dpkg 1.18.9 > ii install-info 6.1.0.dfsg.1-8 > ii libc6 2.23-1 > ii libpcre3 2:8.38-3.1 >=20 > grep recommends no packages. >=20 > Versions of packages grep suggests: > ii libpcre3 2:8.38-3.1 >=20 > -- no debconf information >=20 Note also the behavior when there is not a second match: % printf '%s\n' a b d c | grep -m1 -A3 a a b d c Cheers, Santiago ------------=_1473312362-18248-1--