Received: (at 68989) by debbugs.gnu.org; 13 May 2024 07:27:28 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 13 03:27:28 2024 Received: from localhost ([127.0.0.1]:59096 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1s6Q5o-0006Q9-Fw for submit <at> debbugs.gnu.org; Mon, 13 May 2024 03:27:28 -0400 Received: from mail.cs.ucla.edu ([131.179.128.66]:55336) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1s6Q5m-0006Pz-IO for 68989 <at> debbugs.gnu.org; Mon, 13 May 2024 03:27:27 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id D36FE3C011BDD; Mon, 13 May 2024 00:27:20 -0700 (PDT) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id iYNEW0bXs0sb; Mon, 13 May 2024 00:27:20 -0700 (PDT) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 594533C011BDE; Mon, 13 May 2024 00:27:20 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 594533C011BDE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1715585240; bh=/CmCpD7oWWopk5vn2BfQiXnF40dogWPNdW1hyHtosEk=; h=Message-ID:Date:MIME-Version:To:From; b=gQSfxmlyO+YPlQWam1+zH5EjY9cvfZ7lpLFPX4aka9DK4amclz1b8OnBLT65v7RGc Hrdpde/SBXm+mYphxRmLVecP/7W2Gin537lqYeiSE5o8QFDwTXjOxv/Y8u0QYRQcCT vWgzBqUVjiFbeK7e2E725xrUQtGihtLSoXGnOycOGbn+j/rXOcnK9JqrfLJjyoUb0J XOMeeG1O6BziOv7Iz39B2JTbZJUOY2X0QvN9TYffeGWAaHg6lpJmWGH/uiqDbD3TLY 577Hx6kVDg+UDh+yI0YI6P7d6WmtTU7vrsTCQpiv1olSq6rHyYC+xLJMp29N4ev3cu yTmKvcoOLF3yw== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id 7AEGp8x0oSo3; Mon, 13 May 2024 00:27:20 -0700 (PDT) Received: from [192.168.254.12] (unknown [47.154.17.165]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 378C33C011BDD; Mon, 13 May 2024 00:27:20 -0700 (PDT) Message-ID: <08860ce0-96b9-450c-9dd2-aa989617e675@HIDDEN> Date: Mon, 13 May 2024 00:27:19 -0700 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#68989: grep -m[2+] > /dev/null To: Grisha Levit <grishalevit@HIDDEN> References: <CAMu=Brrn1nUzv8pV7fYa-3GNryTXLi4p73N8ycOAZiHN4VFxYg@HIDDEN> <838e4b9e-d387-4f65-8b87-6c3769cffc34@HIDDEN> <CAMu=BrpFjenbp97SBdP5ncpXqM+BgWDzE0M2F5j1na5QeD3fNg@HIDDEN> Content-Language: en-US From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <CAMu=BrpFjenbp97SBdP5ncpXqM+BgWDzE0M2F5j1na5QeD3fNg@HIDDEN> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 68989 Cc: 68989 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) On 2024-05-12 22:26, Grisha Levit wrote: > Just noticed that with this patch grep has extra output when -m is used > with -[lLq]: > > $ echo x | grep -l -m1 . > x > (standard input) > > $ echo x | grep -q -m1 . > x Thanks for letting us know; I've reopened the bug report.
bug-grep@HIDDEN
:bug#68989
; Package grep
.
Full text available.Debbugs Internal Request <help-debbugs@HIDDEN>
to internal_control <at> debbugs.gnu.org
.
Full text available.Paul Eggert <eggert@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Debbugs Internal Request <help-debbugs@HIDDEN>
to internal_control <at> debbugs.gnu.org
.
Full text available.Debbugs Internal Request <help-debbugs@HIDDEN>
to internal_control <at> debbugs.gnu.org
.
Full text available.Received: (at 68989-done) by debbugs.gnu.org; 9 Feb 2024 09:08:50 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Fri Feb 09 04:08:50 2024 Received: from localhost ([127.0.0.1]:48053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rYMsL-0006x4-N6 for submit <at> debbugs.gnu.org; Fri, 09 Feb 2024 04:08:50 -0500 Received: from mail.cs.ucla.edu ([131.179.128.66]:33356) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <eggert@HIDDEN>) id 1rYMsI-0006wi-Ko for 68989-done <at> debbugs.gnu.org; Fri, 09 Feb 2024 04:08:47 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 9A00D3C011BC5; Fri, 9 Feb 2024 01:08:25 -0800 (PST) Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10032) with ESMTP id g9ps_NeMT3wP; Fri, 9 Feb 2024 01:08:25 -0800 (PST) Received: from localhost (localhost [127.0.0.1]) by mail.cs.ucla.edu (Postfix) with ESMTP id 2716A3C011BD4; Fri, 9 Feb 2024 01:08:25 -0800 (PST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 2716A3C011BD4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu; s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1707469705; bh=NmjL7ivgZkbYDkBK1v1cI3Iqeb4rsSxrH5+e6VuhlC8=; h=Message-ID:Date:MIME-Version:To:From; b=hauMkRJJOzMRzPwq1lXPd6vItnGqY7YmwhnXF5bkIWPdLMX6rEu7DCRY8mjXG3lgu 3A6uDuAsbBrXYx+5OkmzBpAUIvWxj8Wegksk4tBqy71/KLnRRPc/cSTvJAvk0mRrYN RTEx/PtK6c8GIJLSVIfteyZib66pvdcpPfjXNuOl1IpP1oX//GffgcoQutQdLIAISg x6s9e5v5zYUer6TNGVKx7iiCdRHyjy+wtxNK2wtcgZ3c1iftTmhnovpkH9IseYtIKa 4jrvDDmfXt+9yUJxixEjq+92DkxiRR+EHwi61t/q+OAky30BvS9fOcVGGIujyUdKGP VXgys2JLUfDUg== X-Virus-Scanned: amavis at mail.cs.ucla.edu Received: from mail.cs.ucla.edu ([127.0.0.1]) by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavis, port 10026) with ESMTP id gAA2GeXKb9wL; Fri, 9 Feb 2024 01:08:25 -0800 (PST) Received: from [192.168.254.12] (unknown [47.148.192.211]) by mail.cs.ucla.edu (Postfix) with ESMTPSA id 0421A3C011BC5; Fri, 9 Feb 2024 01:08:25 -0800 (PST) Content-Type: multipart/mixed; boundary="------------603uQad2Wcvd40wGxpAeZpxN" Message-ID: <838e4b9e-d387-4f65-8b87-6c3769cffc34@HIDDEN> Date: Fri, 9 Feb 2024 01:08:24 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: bug#68989: grep -m[2+] > /dev/null Content-Language: en-US To: Grisha Levit <grishalevit@HIDDEN> References: <CAMu=Brrn1nUzv8pV7fYa-3GNryTXLi4p73N8ycOAZiHN4VFxYg@HIDDEN> From: Paul Eggert <eggert@HIDDEN> Organization: UCLA Computer Science Department In-Reply-To: <CAMu=Brrn1nUzv8pV7fYa-3GNryTXLi4p73N8ycOAZiHN4VFxYg@HIDDEN> X-Spam-Score: -0.0 (/) X-Debbugs-Envelope-To: 68989-done Cc: 68989-done <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) This is a multi-part message in MIME format. --------------603uQad2Wcvd40wGxpAeZpxN Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Thanks for the bug report. I installed the attached patch; please give it a try. --------------603uQad2Wcvd40wGxpAeZpxN Content-Type: text/x-patch; charset=UTF-8; name="0001-grep-fix-grep-m2-pattern-file-dev-null.patch" Content-Disposition: attachment; filename="0001-grep-fix-grep-m2-pattern-file-dev-null.patch" Content-Transfer-Encoding: base64 RnJvbSBiOWE4MDQ3MDk5ZDIzODhjMTVlNmFkMzllN2I4YzkxYzY2MzMwOTZjIE1vbiBTZXAg MTcgMDA6MDA6MDAgMjAwMQpGcm9tOiBQYXVsIEVnZ2VydCA8ZWdnZXJ0QGNzLnVjbGEuZWR1 PgpEYXRlOiBGcmksIDkgRmViIDIwMjQgMDE6MDY6NDkgLTA4MDAKU3ViamVjdDogW1BBVENI XSA9P1VURi04P3E/Z3JlcDo9MjBmaXg9MjA9RTI9ODA9OThncmVwPTIwLW0yPTIwcGF0dGVy bj0yMDw/PQogPT9VVEYtOD9xP2ZpbGU9MjA+L2Rldi9udWxsPUUyPTgwPTk5Pz0KTUlNRS1W ZXJzaW9uOiAxLjAKQ29udGVudC1UeXBlOiB0ZXh0L3BsYWluOyBjaGFyc2V0PVVURi04CkNv bnRlbnQtVHJhbnNmZXItRW5jb2Rpbmc6IDhiaXQKClByb2JsZW0gcmVwb3J0ZWQgYnkgR3Jp c2hhIExldml0IDxodHRwczovL2J1Z3MuZ251Lm9yZy82ODk4OT4uCiogc3JjL2dyZXAuYyAo Z3JlcCwgbWFpbik6IERvbuKAmXQgc2V0IGRvbmVfb25fbWF0Y2ggaWYgLW0gaXMgdXNlZC4K KiB0ZXN0cy9tYXgtY291bnQtb3ZlcnJlYWQ6IEFkZCBhIHRlc3QgY2FzZS4KLS0tCiBORVdT ICAgICAgICAgICAgICAgICAgICAgfCAzICsrKwogc3JjL2dyZXAuYyAgICAgICAgICAgICAg IHwgOSArKysrKysrLS0KIHRlc3RzL21heC1jb3VudC1vdmVycmVhZCB8IDYgKysrKysrCiAz IGZpbGVzIGNoYW5nZWQsIDE2IGluc2VydGlvbnMoKyksIDIgZGVsZXRpb25zKC0pCgpkaWZm IC0tZ2l0IGEvTkVXUyB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IEluIGdyZXAgMy4xMSwg aXQgd291bGQgY29udGludWUgcmVhZGluZy4KK3ByaW50ZiAneFxueFxueFxuJyA+aW4gfHwg ZnJhbWV3b3JrX2ZhaWx1cmUKKyhncmVwIC1tMiB4ID4vZGV2L251bGwgJiYgaGVhZCAtbjEp IDxpbiA+b3V0IHx8IGZhaWw9MQorY29tcGFyZSBleHAgb3V0IHx8IGZhaWw9MQorCiBFeGl0 ICRmYWlsCi0tIAoyLjQwLjEKCg== --------------603uQad2Wcvd40wGxpAeZpxN--
Grisha Levit <grishalevit@HIDDEN>
:Paul Eggert <eggert@HIDDEN>
:Received: (at submit) by debbugs.gnu.org; 8 Feb 2024 08:38:16 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Feb 08 03:38:16 2024 Received: from localhost ([127.0.0.1]:58979 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1rXzvE-0004aq-7D for submit <at> debbugs.gnu.org; Thu, 08 Feb 2024 03:38:16 -0500 Received: from lists.gnu.org ([2001:470:142::17]:51232) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <grishalevit@HIDDEN>) id 1rXzvD-0004ad-8W for submit <at> debbugs.gnu.org; Thu, 08 Feb 2024 03:38:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <grishalevit@HIDDEN>) id 1rXzur-0001y9-R8 for bug-grep@HIDDEN; Thu, 08 Feb 2024 03:37:53 -0500 Received: from mail-pg1-x52b.google.com ([2607:f8b0:4864:20::52b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <grishalevit@HIDDEN>) id 1rXzuc-00009F-IN for bug-grep@HIDDEN; Thu, 08 Feb 2024 03:37:40 -0500 Received: by mail-pg1-x52b.google.com with SMTP id 41be03b00d2f7-5cf2d73a183so508132a12.1 for <bug-grep@HIDDEN>; Thu, 08 Feb 2024 00:37:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1707381456; x=1707986256; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=imbiKeEOE2W+tToErpUEjdc89g8xvs/15LqSm/YO53Y=; b=YMmdC+T1j/wqHbgBhXirFCZ1jVPMO+1KYY0LUYTSQw8KF1DNyvcgbAeauNi7VxsRdT t2YDhb7GRjOkq5v/G6SRSxeaF3lWa4AEvu679PsEtpkTuiPg5IT/4SIbSlCzwydEPoTj XcuMj061Nqyv8sLKMFKgyGN/FYgZZBZzA/p17PV2k3lfyiMXI30x+4T/75nzwU5czKQb giUkKFhAKcyUttTMctBm3Ep8mslGACU1Tbf7eo5J5cDql0EV6eay03UezHCXh1583o+l y7Ayy+FJQ/Cqg8lBk01gFg5gShGztFM4+xaZknve23kguWLD2GxW6ugTkoq1yYql4mlF DgMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707381456; x=1707986256; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=imbiKeEOE2W+tToErpUEjdc89g8xvs/15LqSm/YO53Y=; b=rTYMlpUl1Q12hBsUFRA4kRnr6z0JwxfUKiJj4RY+njOj/GGKzm9zLhRD4kGQ8IBXji 0r9gzKJL1lBisXYRzXNRxsM6m8U5szqH/5KpCoAKHyUbranRvXdIhjo1Le+zh9grGtKm aV6jMDaa3acckboMrWI5uO3a0l/bzCX74Kywezia7FESGeslhRUApxrj7rqT7NWk2E6i o3p/WiHktZ8nUeboRbhlAgyJjgxE5/oaP7oVs+51Rw+BrKO9GCmklCGoMSJwPcqjeBAM 2oGS3HP7G4CkWgGji174hC5IFyPjnjC1qiMFg30T9gOENJWChHrNR/pkSjrIEivJU3C7 yDyA== X-Gm-Message-State: AOJu0YxoGdujPiLqI3ATPjZDrSb0oPYyqv7YRie9bws05Old3Q+/5rKN ioL32xpT+JNKeX8jiS9XJSVfapsAsFhExmEZGd1g0bIv2/vg1N63WOtyCUHZUhYlqEItdj0iMz6 j0+vZtXAjKNbD9geAD8it1lDMLiK3/Ub5 X-Google-Smtp-Source: AGHT+IG3BrAnW/P/OUdlzGbL0ZPW+W9GuWHUgewFCwtIQOM3ju0zEpNVBIR4m5DYSB2MHO/cK9/CnTF9eMKT9Bk+Blk= X-Received: by 2002:a17:90a:cb0a:b0:295:aaaa:74fe with SMTP id z10-20020a17090acb0a00b00295aaaa74femr3444042pjt.14.1707381456370; Thu, 08 Feb 2024 00:37:36 -0800 (PST) MIME-Version: 1.0 From: Grisha Levit <grishalevit@HIDDEN> Date: Thu, 8 Feb 2024 03:37:24 -0500 Message-ID: <CAMu=Brrn1nUzv8pV7fYa-3GNryTXLi4p73N8ycOAZiHN4VFxYg@HIDDEN> Subject: grep -m[2+] > /dev/null To: bug-grep@HIDDEN Content-Type: multipart/alternative; boundary="0000000000003400d40610dab974" Received-SPF: pass client-ip=2607:f8b0:4864:20::52b; envelope-from=grishalevit@HIDDEN; helo=mail-pg1-x52b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) --0000000000003400d40610dab974 Content-Type: text/plain; charset="UTF-8" This example file will require multiple reads: $ printf '%07d\n' {0..98304} > txt When limiting the match count to 1, the input offset is correctly restored before grep exits, no matter the output: $ { grep -m1 . >/dev/zero; head -n1; } < txt 0000001 $ { grep -m1 . >/dev/null; head -n1; } < txt 0000001 If the count is 2 or higher, this also works, unless the output is being discarded to /dev/null -- in this case not only is the input offset not restored, but the entire file is consumed: $ { grep -m2 . >/dev/zero; head -n1; } < txt 0000002 $ { grep -m2 . >/dev/null; head -n1; } < txt $ --0000000000003400d40610dab974 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"auto"><div dir=3D"auto">This example file will require multiple= reads:</div><div dir=3D"auto"><br></div>$ printf '%07d\n' {0..9830= 4} > txt<div dir=3D"auto"><br></div><div dir=3D"auto">When limiting the = match count to 1, the input offset is correctly restored before grep exits,= =C2=A0 no matter the output:</div><div dir=3D"auto"><br></div><div dir=3D"a= uto"><div dir=3D"auto">$ { grep -m1 . >/dev/zero; head -n1; } < txt</= div><div dir=3D"auto">0000001</div><div dir=3D"auto">$ { grep -m1 . >/de= v/null; head -n1; } < txt</div><div dir=3D"auto">0000001</div><div dir= =3D"auto"><br></div><div dir=3D"auto">If the count is 2 or higher, this als= o works, unless the output is being discarded to /dev/null -- in this case = not only is the input offset not restored, but the entire file is consumed:= </div><div dir=3D"auto"><br></div><div dir=3D"auto">$ { grep -m2 . >/dev= /zero; head -n1; } < txt</div><div dir=3D"auto">0000002</div><div dir=3D= "auto">$ { grep -m2 . >/dev/null; head -n1; } < txt</div><div dir=3D"= auto">$</div><div dir=3D"auto"><br></div><div dir=3D"auto"><br></div></div>= </div> --0000000000003400d40610dab974--
Grisha Levit <grishalevit@HIDDEN>
:bug-grep@HIDDEN
.
Full text available.bug-grep@HIDDEN
:bug#68989
; Package grep
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.