GNU bug report logs - #69929
Can grep -q report matches in incomplete lines?

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: grep; Reported by: Niels Möller <nisse@HIDDEN>; dated Thu, 21 Mar 2024 13:58:02 UTC; Maintainer for grep is bug-grep@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Mar 2024 16:15:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 25 12:15:15 2024
Received: from localhost ([127.0.0.1]:35856 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1romyh-00072V-1X
	for submit <at> debbugs.gnu.org; Mon, 25 Mar 2024 12:15:15 -0400
Received: from lists.gnu.org ([2001:470:142::17]:46840)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1romyb-00070A-4U
 for submit <at> debbugs.gnu.org; Mon, 25 Mar 2024 12:15:10 -0400
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 <eggert@HIDDEN>)
 id 1rok6b-0004xO-O4
 for bug-grep@HIDDEN; Mon, 25 Mar 2024 09:11:13 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1rok6Z-0003XT-5Q
 for bug-grep@HIDDEN; Mon, 25 Mar 2024 09:11:13 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id C32223C011BE0
 for <bug-grep@HIDDEN>; Mon, 25 Mar 2024 06:11:07 -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 os6WrQmfPSu9 for <bug-grep@HIDDEN>; Mon, 25 Mar 2024 06:11:07 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 5B6373C013279
 for <bug-grep@HIDDEN>; Mon, 25 Mar 2024 06:11:07 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 5B6373C013279
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1711372267;
 bh=k85qwd/Baj6MI8N/cw/OYT9uSonYnOynsTdqK5UADEc=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=VKO1nv1GUKWoe9dnTKBmSXsKRRisyrs3QLBrG318elS23Xtre4nRxcnhYok14Qzoe
 4/aG6M+/zoEG+Xn6cmjjfz1A3nffArKrS2BWqefMLo9Rn5xEw0McMAmIQHGMo7IZDK
 dCyBfGqF4G8jcACASTASVqsGmAIhs4MRQVVkRiTGcIN1HcqWDeFWgAO8Hiag01brV6
 VaQBXO66E+ErIJFRHfNFdv0qmC9Hu/hotNNmYgNK7jhTHMFxR5HRZ0fIkOqNPYyDU8
 EzEbq+BTiF/wPeWbwIfDN67sSwTRSSCKB0NyJtdB2adV8pHoh0A75eLIFb5/n6GcID
 0CS5LaXuoYN4w==
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 yPZlt-LkICBK for <bug-grep@HIDDEN>; Mon, 25 Mar 2024 06:11:07 -0700 (PDT)
Received: from [192.168.254.12] (unknown [47.154.17.165])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 405433C011BE0
 for <bug-grep@HIDDEN>; Mon, 25 Mar 2024 06:11:07 -0700 (PDT)
Message-ID: <f8245567-ef77-4355-848f-88953be9c3fb@HIDDEN>
Date: Mon, 25 Mar 2024 06:11:06 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
To: bug-grep@HIDDEN
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
 <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
 <997458040.701866.1711285573254@HIDDEN>
 <2221a3b2-92c2-45b8-bfe8-405f8841d5af@HIDDEN>
 <20240325064711.GA24132@phoenix>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <20240325064711.GA24132@phoenix>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@HIDDEN;
 helo=mail.cs.ucla.edu
X-Spam_score_int: -19
X-Spam_score: -2.0
X-Spam_bar: --
X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 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 (/)

On 2024-03-24 23:47, Gary Johnson wrote:
> grep is small enough in concept that it shouldn't
> require the user to read anything outside of the man page.

Maybe grep's concept is simple, but the program itself is not that 
simple. For example, the grep man page doesn't document all the ins and 
outs of PCREs. (Not even the manual does that!)

The GNU Coding Standards are pretty clear that man pages are 
secondary.[1] To some extent the GNU grep man page is already too long 
and detailed. FreeBSD's grep man page[2] is a better length (and 
amusingly, it also doesn't mention the minor detail of files ending in 
non-newline).

[1]: https://www.gnu.org/prep/standards/html_node/Man-Pages.html
[2]: https://man.freebsd.org/cgi/man.cgi?query=grep




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Mar 2024 06:53:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 25 02:53:55 2024
Received: from localhost ([127.0.0.1]:47806 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1roeDS-0006Lt-Mt
	for submit <at> debbugs.gnu.org; Mon, 25 Mar 2024 02:53:54 -0400
Received: from lists.gnu.org ([209.51.188.17]:39352)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <garyjohn@HIDDEN>) id 1roeDP-0006Lk-RD
 for submit <at> debbugs.gnu.org; Mon, 25 Mar 2024 02:53:52 -0400
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 <garyjohn@HIDDEN>)
 id 1roeCi-00051Q-UP
 for bug-grep@HIDDEN; Mon, 25 Mar 2024 02:53:08 -0400
Received: from mail.spocom.com ([206.63.224.240])
 by eggs.gnu.org with esmtp (Exim 4.90_1)
 (envelope-from <garyjohn@HIDDEN>) id 1roeCg-0004Wj-Ju
 for bug-grep@HIDDEN; Mon, 25 Mar 2024 02:53:08 -0400
Authentication-Results: smtp.smartermail.cet.com; none
Received: from localhost (89.sub-75-226-190.myvzw.com [75.226.190.89]) by
 mail.spocom.com with SMTP; Sun, 24 Mar 2024 23:46:39 -0700
Date: Sun, 24 Mar 2024 23:47:11 -0700
From: Gary Johnson <garyjohn@HIDDEN>
To: bug-grep@HIDDEN
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
Message-ID: <20240325064711.GA24132@phoenix>
Mail-Followup-To: bug-grep@HIDDEN
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
 <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
 <997458040.701866.1711285573254@HIDDEN>
 <2221a3b2-92c2-45b8-bfe8-405f8841d5af@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <2221a3b2-92c2-45b8-bfe8-405f8841d5af@HIDDEN>
X-Operating-System: Linux 2.6.32-74-generic GNU/Linux
User-Agent: Mutt/1.5.20 (2009-06-14)
Received-SPF: pass client-ip=206.63.224.240; envelope-from=garyjohn@HIDDEN;
 helo=mail.spocom.com
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
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: -2.3 (--)

On 2024-03-24, Paul Eggert wrote:
> On 2024-03-24 06:06, David G. Pickett wrote:
> >  Perhaps the man page should warn users that such last lines are ignored.
> 
> They aren't ignored. And the documentation already covers this issue,
> on its very first page:
> 
> https://www.gnu.org/software/grep/manual/html_node/Introduction.html
> 
> This says, "If the final byte of an input file is not a newline, grep
> silently supplies one."
> 
> I doubt whether this minor issue should be covered in the man page,
> as it is merely a brief summary of the documentation.

I would call the man page a _concise_ summary of the behavior of the
topic program or function, but I don't think it should be an
abridged summary.  It should be complete.  There should not be any
feature or behavior of the program or function completely missing
from the man page.  Other documentation may expand upon and further
explain behavior, but it should not contain the only mention of some
behavior.

Exceptions may be made for larger, more complicated programs such
as gnuplot, make or gdb, that do require a full manual apart from
a man page, but grep is small enough in concept that it shouldn't
require the user to read anything outside of the man page.

My unsolicited $0.02.

Regards,
Gary





Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 25 Mar 2024 01:36:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 24 21:36:36 2024
Received: from localhost ([127.0.0.1]:47669 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1roZGO-0005gR-Cn
	for submit <at> debbugs.gnu.org; Sun, 24 Mar 2024 21:36:36 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:51752)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1roZGK-0005g5-Jb
 for 69929 <at> debbugs.gnu.org; Sun, 24 Mar 2024 21:36:34 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id ED4FC3C011BD4;
 Sun, 24 Mar 2024 18:35:44 -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 Q2oaxyHuxHff; Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 6EF963C011BD8;
 Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 6EF963C011BD8
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1711330544;
 bh=2n/7+UejjUoHoDIuJo3tDPBoaRbHOQciF8yf2rJqyPc=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=Zf8nQCWqDg9/B9o0szZ5P7zYCqVic/V3CmU45Xp/E67RBCWJWL2sY+TtZv8Im58hv
 HuPsFSrL8dxZsbU8bU6FseSzIiNLc0qppG8741X+agO80MAMYyAtl/hvZO7uypRvuc
 /wIBBokZMbdpmN303d0ZeeCsP53VIL+ZdDbIzlMPuh09pD9PJnofahiWY2KttWD4yn
 Zlnh0/fCaZeGUB/awmqvkv9AepcmZlRBj6BChWOwp0Svts1AsuyQgJ/rrBnrGNc5or
 BXpdZIYqwYJyT6XMY2lw8k+LNgv9uDoXFw0W9VbiKH483T24L6cUEkEmrEcVb+qBxs
 os8VncW78z1AQ==
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 qWC-TyQjWVGh; Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
Received: from [192.168.254.12] (unknown [47.154.17.165])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 4915A3C011BD4;
 Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
Message-ID: <2221a3b2-92c2-45b8-bfe8-405f8841d5af@HIDDEN>
Date: Sun, 24 Mar 2024 18:35:43 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
To: "David G. Pickett" <dgpickett@HIDDEN>,
 Martin Schulte <gnu@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
 <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
 <997458040.701866.1711285573254@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <997458040.701866.1711285573254@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69929
Cc: "69929 <at> debbugs.gnu.org" <69929 <at> debbugs.gnu.org>,
 "bug-grep@HIDDEN" <bug-grep@HIDDEN>,
 "nisse@HIDDEN" <nisse@HIDDEN>
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-03-24 06:06, David G. Pickett wrote:
>   Perhaps the man page should warn users that such last lines are ignored.

They aren't ignored. And the documentation already covers this issue, on 
its very first page:

https://www.gnu.org/software/grep/manual/html_node/Introduction.html

This says, "If the final byte of an input file is not a newline, grep 
silently supplies one."

I doubt whether this minor issue should be covered in the man page, as 
it is merely a brief summary of the documentation.




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 25 Mar 2024 01:36:41 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 24 21:36:41 2024
Received: from localhost ([127.0.0.1]:47671 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1roZGS-0005gh-Ms
	for submit <at> debbugs.gnu.org; Sun, 24 Mar 2024 21:36:41 -0400
Received: from lists.gnu.org ([209.51.188.17]:59856)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1roZGK-0005gC-D8
 for submit <at> debbugs.gnu.org; Sun, 24 Mar 2024 21:36:36 -0400
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 <eggert@HIDDEN>)
 id 1roZFd-0005MZ-Ms
 for bug-grep@HIDDEN; Sun, 24 Mar 2024 21:35:49 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eggert@HIDDEN>)
 id 1roZFb-0004Qd-Eb
 for bug-grep@HIDDEN; Sun, 24 Mar 2024 21:35:49 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id ED4FC3C011BD4;
 Sun, 24 Mar 2024 18:35:44 -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 Q2oaxyHuxHff; Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 6EF963C011BD8;
 Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 6EF963C011BD8
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1711330544;
 bh=2n/7+UejjUoHoDIuJo3tDPBoaRbHOQciF8yf2rJqyPc=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=Zf8nQCWqDg9/B9o0szZ5P7zYCqVic/V3CmU45Xp/E67RBCWJWL2sY+TtZv8Im58hv
 HuPsFSrL8dxZsbU8bU6FseSzIiNLc0qppG8741X+agO80MAMYyAtl/hvZO7uypRvuc
 /wIBBokZMbdpmN303d0ZeeCsP53VIL+ZdDbIzlMPuh09pD9PJnofahiWY2KttWD4yn
 Zlnh0/fCaZeGUB/awmqvkv9AepcmZlRBj6BChWOwp0Svts1AsuyQgJ/rrBnrGNc5or
 BXpdZIYqwYJyT6XMY2lw8k+LNgv9uDoXFw0W9VbiKH483T24L6cUEkEmrEcVb+qBxs
 os8VncW78z1AQ==
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 qWC-TyQjWVGh; Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
Received: from [192.168.254.12] (unknown [47.154.17.165])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 4915A3C011BD4;
 Sun, 24 Mar 2024 18:35:44 -0700 (PDT)
Message-ID: <2221a3b2-92c2-45b8-bfe8-405f8841d5af@HIDDEN>
Date: Sun, 24 Mar 2024 18:35:43 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
To: "David G. Pickett" <dgpickett@HIDDEN>,
 Martin Schulte <gnu@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
 <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
 <997458040.701866.1711285573254@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <997458040.701866.1711285573254@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=131.179.128.66; envelope-from=eggert@HIDDEN;
 helo=mail.cs.ucla.edu
X-Spam_score_int: -19
X-Spam_score: -2.0
X-Spam_bar: --
X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
Cc: "69929 <at> debbugs.gnu.org" <69929 <at> debbugs.gnu.org>,
 "bug-grep@HIDDEN" <bug-grep@HIDDEN>,
 "nisse@HIDDEN" <nisse@HIDDEN>
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: -2.3 (--)

On 2024-03-24 06:06, David G. Pickett wrote:
>   Perhaps the man page should warn users that such last lines are ignored.

They aren't ignored. And the documentation already covers this issue, on 
its very first page:

https://www.gnu.org/software/grep/manual/html_node/Introduction.html

This says, "If the final byte of an input file is not a newline, grep 
silently supplies one."

I doubt whether this minor issue should be covered in the man page, as 
it is merely a brief summary of the documentation.




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 24 Mar 2024 13:07:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 24 09:07:10 2024
Received: from localhost ([127.0.0.1]:56997 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1roNZ3-0001Uk-1R
	for submit <at> debbugs.gnu.org; Sun, 24 Mar 2024 09:07:09 -0400
Received: from sonic317-20.consmr.mail.gq1.yahoo.com ([98.137.66.146]:37793)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dgpickett@HIDDEN>) id 1roNZ0-0001Ty-A8
 for 69929 <at> debbugs.gnu.org; Sun, 24 Mar 2024 09:07:04 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1711285574; bh=BMOMVcjxi6NlQFSQTrBOIvMj81RmJS1ehZgr/Z4VNNI=;
 h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To;
 b=GBgtjaOvRS6EGjZPWSWQowQBilunCuD9Wgo9WfdDZXrqJUs3aTJ3a4R4I+V4IJvLqhOy5oNz8cPvJ0iyhXDTf2D1YmdyzEIvyPHsQ+s8c8bj59LSEe8AlT0SJFRMg084V5IKBbdhV0geenlQFBavL/7Jc90p/PVqrp2KpS6mK8K771fEd2E0kI4T+h5n1e7crT7qoAfzmKT9xZZU29in5YMpm2+oGPuu2T0/n0pspO+v1STz37a7iq6tCkTeetO/wyfw7pnoPJXoWLKd2CfULzG/dfCv7gwBE9Lospmy9h83pp/Q4lr0j+TkzuErONbCoT1L52nk8UgP+yCaIlKDDg==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1711285574; bh=sK+UodVWk3TcRfX8aapspF+Jvo4PIa5OTAzfnYk/8Fs=;
 h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
 b=SafReGa243M0EnFundNMVyJ2nzp8cwug1SdpgNgTkXvDP4mJuWnW2Y62DddRMJLjguk5ScggtU4rvvoJW0iPJmFXw547zL3FSdLGBPE2L57GR3qAEkghUEULhF0ms7lq6xwJclZqCwG9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X.NnhTCnXECqBlEOcJ0sHJZ.GoORl8eeunLho4p.mXA06uH_.C90QkHfJkLCVTKpAAo1I9x
 qFlqTc7DwOB2niSakxcrzfjhLS4m0blJvXpPI_VzQm41M0T4QUUndHCCh2KyyXTq2of0QM85Sn8C
 Wvm407_nh.hQTvxo7Uh3HwwJx2mpCY3Z7JUjO2xaRwGlmxyKGOdooUJJQi.bn_qOSinNpWjJwMBn
 YxBcFPO947DuudTnrK6Si0t.8DaClglBdNDU9bXf7.EH8.sdibLlino0c8R8Wx4ZG_M_raUSKpg3
 13QkbUAlr8zv5XjjCGL6zWKqIEIQw5BDp5l55qrX.33fRyqEE.v5ADB1t78Nsa8Wf3iIqgHfv_b8
 Os8oTPj3xDyeC
X-Sonic-MF: <dgpickett@HIDDEN>
X-Sonic-ID: 78b2037c-04aa-48d2-950b-426fb357bd13
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic317.consmr.mail.gq1.yahoo.com with HTTP; Sun, 24 Mar 2024 13:06:14 +0000
Date: Sun, 24 Mar 2024 13:06:13 +0000 (UTC)
From: "David G. Pickett" <dgpickett@HIDDEN>
To: Martin Schulte <gnu@HIDDEN>
Message-ID: <997458040.701866.1711285573254@HIDDEN>
In-Reply-To: <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
 <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_701865_782572518.1711285573253"
X-Mailer: WebService/1.1.22205 AolMailNorrin
Content-Length: 3415
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69929
Cc: "69929 <at> debbugs.gnu.org" <69929 <at> debbugs.gnu.org>,
 "bug-grep@HIDDEN" <bug-grep@HIDDEN>,
 "nisse@HIDDEN" <nisse@HIDDEN>,
 "eggert@HIDDEN" <eggert@HIDDEN>
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 (-)

------=_Part_701865_782572518.1711285573253
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 Perhaps the man page should warn users that such last lines are ignored.=
=C2=A0 Is there a mention under an option to include or disclude them?
    On Saturday, March 23, 2024 at 05:08:08 PM EDT, Martin Schulte <gnu@sch=
rader-schulte.de> wrote: =20
=20
 Hello David!

Am Fri, 22 Mar 2024 20:42:12 +0000 (UTC) schrieb "David G. Pickett" via Bug=
 reports for GNU grep <bug-grep@HIDDEN>:
> Most users consider a line at EOF lacking a trailing newline as still a l=
ine, but perhaps some do not?

Well, POSIX doesn't: https://pubs.opengroup.org/onlinepubs/9699919799/based=
efs/V1_chap03.html#tag_03_206

The definition may cause trouble with shell's read - e.g. when reading a fi=
le created on Windows with notepad where it is easy to accidentally create =
an incomplete line (compared to vi where I don't know an easy way).

Best regards,

Martin
 =20
------=_Part_701865_782572518.1711285573253
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"ydp2a91bb1byahoo-style-wrap" style=
=3D"font-family:Verdana, Arial, Helvetica, sans-serif;font-size:16px;"><div=
></div>
        <div dir=3D"ltr" data-setdir=3D"false">Perhaps the man page should =
warn users that such last lines are ignored.&nbsp; Is there a mention under=
 an option to include or disclude them?</div><div><br></div>
       =20
        </div><div id=3D"ydpe7757f36yahoo_quoted_1981245814" class=3D"ydpe7=
757f36yahoo_quoted">
            <div style=3D"font-family:'Helvetica Neue', Helvetica, Arial, s=
ans-serif;font-size:13px;color:#26282a;">
               =20
                <div>
                        On Saturday, March 23, 2024 at 05:08:08 PM EDT, Mar=
tin Schulte &lt;gnu@HIDDEN&gt; wrote:
                    </div>
                    <div><br></div>
                    <div><br></div>
               =20
               =20
                <div><div dir=3D"ltr">Hello David!<br clear=3D"none"><div c=
lass=3D"ydpe7757f36yqt7747476598" id=3D"ydpe7757f36yqtfd48485"><br clear=3D=
"none">Am Fri, 22 Mar 2024 20:42:12 +0000 (UTC) schrieb "David G. Pickett" =
via Bug reports for GNU grep &lt;<a shape=3D"rect" href=3D"mailto:bug-grep@=
gnu.org" rel=3D"nofollow" target=3D"_blank">bug-grep@HIDDEN</a>&gt;:<br cl=
ear=3D"none">&gt; Most users consider a line at EOF lacking a trailing newl=
ine as still a line, but perhaps some do not?</div><br clear=3D"none"><br c=
lear=3D"none">Well, POSIX doesn't: <a shape=3D"rect" href=3D"https://pubs.o=
pengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206" rel=
=3D"nofollow" target=3D"_blank" fg_scanned=3D"1">https://pubs.opengroup.org=
/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206</a><br clear=3D"n=
one"><br clear=3D"none">The definition may cause trouble with shell's read =
- e.g. when reading a file created on Windows with notepad where it is easy=
 to accidentally create an incomplete line (compared to vi where I don't kn=
ow an easy way).<br clear=3D"none"><br clear=3D"none">Best regards,<br clea=
r=3D"none"><br clear=3D"none">Martin<div class=3D"ydpe7757f36yqt7747476598"=
 id=3D"ydpe7757f36yqtfd30186"><br clear=3D"none"></div></div></div>
            </div>
        </div></body></html>
------=_Part_701865_782572518.1711285573253--




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 24 Mar 2024 13:07:11 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Mar 24 09:07:11 2024
Received: from localhost ([127.0.0.1]:57009 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1roNZ8-0001V4-15
	for submit <at> debbugs.gnu.org; Sun, 24 Mar 2024 09:07:11 -0400
Received: from lists.gnu.org ([209.51.188.17]:36886)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dgpickett@HIDDEN>) id 1roNZ4-0001Uo-Lc
 for submit <at> debbugs.gnu.org; Sun, 24 Mar 2024 09:07:07 -0400
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 <dgpickett@HIDDEN>) id 1roNYN-00047w-8X
 for bug-grep@HIDDEN; Sun, 24 Mar 2024 09:06:23 -0400
Received: from sonic317-20.consmr.mail.gq1.yahoo.com ([98.137.66.146])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <dgpickett@HIDDEN>) id 1roNYI-00009B-Ma
 for bug-grep@HIDDEN; Sun, 24 Mar 2024 09:06:22 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1711285574; bh=BMOMVcjxi6NlQFSQTrBOIvMj81RmJS1ehZgr/Z4VNNI=;
 h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To;
 b=GBgtjaOvRS6EGjZPWSWQowQBilunCuD9Wgo9WfdDZXrqJUs3aTJ3a4R4I+V4IJvLqhOy5oNz8cPvJ0iyhXDTf2D1YmdyzEIvyPHsQ+s8c8bj59LSEe8AlT0SJFRMg084V5IKBbdhV0geenlQFBavL/7Jc90p/PVqrp2KpS6mK8K771fEd2E0kI4T+h5n1e7crT7qoAfzmKT9xZZU29in5YMpm2+oGPuu2T0/n0pspO+v1STz37a7iq6tCkTeetO/wyfw7pnoPJXoWLKd2CfULzG/dfCv7gwBE9Lospmy9h83pp/Q4lr0j+TkzuErONbCoT1L52nk8UgP+yCaIlKDDg==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1711285574; bh=sK+UodVWk3TcRfX8aapspF+Jvo4PIa5OTAzfnYk/8Fs=;
 h=X-Sonic-MF:Date:From:To:Subject:From:Subject;
 b=SafReGa243M0EnFundNMVyJ2nzp8cwug1SdpgNgTkXvDP4mJuWnW2Y62DddRMJLjguk5ScggtU4rvvoJW0iPJmFXw547zL3FSdLGBPE2L57GR3qAEkghUEULhF0ms7lq6xwJclZqCwG9ZjfbgxRLtE4Jtbat75O7hxPd7UWtRZfY17BcdeKHWmk3D9ipGa2P5pjwpMFYWJde7GYm+5GJHy4N+oLler5yQ8ttnLHBkPVyYcmzNqmdNQiWZIAUfbxMcpKgYzyCrIJ1+VqB50x8snJNegLPOSqZB9HspLIzEZizFS5YNeEruGtUcOwjZpem/cyzJBOHhEF+gCX6FKR6zQ==
X-YMail-OSG: 73DN400VM1n4FKM9gZIdtfWSAya96w24oYYsSROjnrFc_avbtygISgsZSoN.NrW
 G50j1_fZUEtxPAdB99oEoLZymo8zVcJK.MBumNYCUpn2SeZMS7UABQv0sRF0AtaV4BN4MNudIyJT
 2EwTXx_Hq6IR1LgT0Gz2OpzyjcyY2H09wTSwPmeVNlF.P4YhK5DAj5LndRRathuodmIkThY9C6yb
 OduCU5VcQ.zMvrZR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a-48d2-950b-426fb357bd13
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic317.consmr.mail.gq1.yahoo.com with HTTP; Sun, 24 Mar 2024 13:06:14 +0000
Date: Sun, 24 Mar 2024 13:06:13 +0000 (UTC)
From: "David G. Pickett" <dgpickett@HIDDEN>
To: Martin Schulte <gnu@HIDDEN>
Message-ID: <997458040.701866.1711285573254@HIDDEN>
In-Reply-To: <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
 <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_701865_782572518.1711285573253"
X-Mailer: WebService/1.1.22205 AolMailNorrin
Content-Length: 3415
Received-SPF: pass client-ip=98.137.66.146; envelope-from=dgpickett@HIDDEN;
 helo=sonic317-20.consmr.mail.gq1.yahoo.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, RCVD_IN_MSPIKE_H2=-0.001,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.7 (-)
X-Debbugs-Envelope-To: submit
Cc: "69929 <at> debbugs.gnu.org" <69929 <at> debbugs.gnu.org>,
 "bug-grep@HIDDEN" <bug-grep@HIDDEN>,
 "nisse@HIDDEN" <nisse@HIDDEN>,
 "eggert@HIDDEN" <eggert@HIDDEN>
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: -2.7 (--)

------=_Part_701865_782572518.1711285573253
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 Perhaps the man page should warn users that such last lines are ignored.=
=C2=A0 Is there a mention under an option to include or disclude them?
    On Saturday, March 23, 2024 at 05:08:08 PM EDT, Martin Schulte <gnu@sch=
rader-schulte.de> wrote: =20
=20
 Hello David!

Am Fri, 22 Mar 2024 20:42:12 +0000 (UTC) schrieb "David G. Pickett" via Bug=
 reports for GNU grep <bug-grep@HIDDEN>:
> Most users consider a line at EOF lacking a trailing newline as still a l=
ine, but perhaps some do not?

Well, POSIX doesn't: https://pubs.opengroup.org/onlinepubs/9699919799/based=
efs/V1_chap03.html#tag_03_206

The definition may cause trouble with shell's read - e.g. when reading a fi=
le created on Windows with notepad where it is easy to accidentally create =
an incomplete line (compared to vi where I don't know an easy way).

Best regards,

Martin
 =20
------=_Part_701865_782572518.1711285573253
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"ydp2a91bb1byahoo-style-wrap" style=
=3D"font-family:Verdana, Arial, Helvetica, sans-serif;font-size:16px;"><div=
></div>
        <div dir=3D"ltr" data-setdir=3D"false">Perhaps the man page should =
warn users that such last lines are ignored.&nbsp; Is there a mention under=
 an option to include or disclude them?</div><div><br></div>
       =20
        </div><div id=3D"ydpe7757f36yahoo_quoted_1981245814" class=3D"ydpe7=
757f36yahoo_quoted">
            <div style=3D"font-family:'Helvetica Neue', Helvetica, Arial, s=
ans-serif;font-size:13px;color:#26282a;">
               =20
                <div>
                        On Saturday, March 23, 2024 at 05:08:08 PM EDT, Mar=
tin Schulte &lt;gnu@HIDDEN&gt; wrote:
                    </div>
                    <div><br></div>
                    <div><br></div>
               =20
               =20
                <div><div dir=3D"ltr">Hello David!<br clear=3D"none"><div c=
lass=3D"ydpe7757f36yqt7747476598" id=3D"ydpe7757f36yqtfd48485"><br clear=3D=
"none">Am Fri, 22 Mar 2024 20:42:12 +0000 (UTC) schrieb "David G. Pickett" =
via Bug reports for GNU grep &lt;<a shape=3D"rect" href=3D"mailto:bug-grep@=
gnu.org" rel=3D"nofollow" target=3D"_blank">bug-grep@HIDDEN</a>&gt;:<br cl=
ear=3D"none">&gt; Most users consider a line at EOF lacking a trailing newl=
ine as still a line, but perhaps some do not?</div><br clear=3D"none"><br c=
lear=3D"none">Well, POSIX doesn't: <a shape=3D"rect" href=3D"https://pubs.o=
pengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206" rel=
=3D"nofollow" target=3D"_blank" fg_scanned=3D"1">https://pubs.opengroup.org=
/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206</a><br clear=3D"n=
one"><br clear=3D"none">The definition may cause trouble with shell's read =
- e.g. when reading a file created on Windows with notepad where it is easy=
 to accidentally create an incomplete line (compared to vi where I don't kn=
ow an easy way).<br clear=3D"none"><br clear=3D"none">Best regards,<br clea=
r=3D"none"><br clear=3D"none">Martin<div class=3D"ydpe7757f36yqt7747476598"=
 id=3D"ydpe7757f36yqtfd30186"><br clear=3D"none"></div></div></div>
            </div>
        </div></body></html>
------=_Part_701865_782572518.1711285573253--




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 23 Mar 2024 21:27:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 17:27:46 2024
Received: from localhost ([127.0.0.1]:54853 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ro8u2-0004nv-Fr
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 17:27:46 -0400
Received: from sb.ds-gmbh.de ([91.184.37.131]:35776)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gnu@HIDDEN>) id 1ro8u0-0004nl-VY
 for 69929 <at> debbugs.gnu.org; Sat, 23 Mar 2024 17:27:45 -0400
Received: from gwp.linuxhotel.de ([185.232.103.116] helo=martnix4.ds-gmbh.de)
 by sb.ds-gmbh.de with esmtpsa
 (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92)
 (envelope-from <gnu@HIDDEN>)
 id 1ro8az-0000wa-9N; Sat, 23 Mar 2024 22:08:05 +0100
Date: Sat, 23 Mar 2024 22:07:58 +0100
From: Martin Schulte <gnu@HIDDEN>
To: "David G. Pickett" <dgpickett@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
Message-Id: <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
In-Reply-To: <1991478992.366613.1711140132607@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-Spam-Score: -3.3 (---)
X-Debbugs-Envelope-To: 69929
Cc: 69929 <at> debbugs.gnu.org, bug-grep@HIDDEN, nisse@HIDDEN,
 eggert@HIDDEN
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: -4.3 (----)

Hello David!

Am Fri, 22 Mar 2024 20:42:12 +0000 (UTC) schrieb "David G. Pickett" via Bug reports for GNU grep <bug-grep@HIDDEN>:
> Most users consider a line at EOF lacking a trailing newline as still a line, but perhaps some do not?

Well, POSIX doesn't: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206

The definition may cause trouble with shell's read - e.g. when reading a file created on Windows with notepad where it is easy to accidentally create an incomplete line (compared to vi where I don't know an easy way).

Best regards,

Martin




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Mar 2024 21:25:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 17:25:21 2024
Received: from localhost ([127.0.0.1]:54754 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ro8rg-0004iL-IF
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 17:25:21 -0400
Received: from lists.gnu.org ([209.51.188.17]:60446)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <gnu@HIDDEN>) id 1ro8bq-00044W-1S
 for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 17:08:59 -0400
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 <gnu@HIDDEN>)
 id 1ro8b6-0005VN-Od
 for bug-grep@HIDDEN; Sat, 23 Mar 2024 17:08:13 -0400
Received: from sb.ds-gmbh.de ([91.184.37.131])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <gnu@HIDDEN>)
 id 1ro8b4-00058B-Qj
 for bug-grep@HIDDEN; Sat, 23 Mar 2024 17:08:12 -0400
Received: from gwp.linuxhotel.de ([185.232.103.116] helo=martnix4.ds-gmbh.de)
 by sb.ds-gmbh.de with esmtpsa
 (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92)
 (envelope-from <gnu@HIDDEN>)
 id 1ro8az-0000wa-9N; Sat, 23 Mar 2024 22:08:05 +0100
Date: Sat, 23 Mar 2024 22:07:58 +0100
From: Martin Schulte <gnu@HIDDEN>
To: "David G. Pickett" <dgpickett@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
Message-Id: <20240323220758.ad33a3c918fb7c9fb3de58ec@HIDDEN>
In-Reply-To: <1991478992.366613.1711140132607@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu)
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=91.184.37.131;
 envelope-from=gnu@HIDDEN; helo=sb.ds-gmbh.de
X-Spam_score_int: -46
X-Spam_score: -4.7
X-Spam_bar: ----
X-Spam_report: (-4.7 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-2.785,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -4.6 (----)
X-Debbugs-Envelope-To: submit
Cc: 69929 <at> debbugs.gnu.org, bug-grep@HIDDEN, nisse@HIDDEN,
 eggert@HIDDEN
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: -5.6 (-----)

Hello David!

Am Fri, 22 Mar 2024 20:42:12 +0000 (UTC) schrieb "David G. Pickett" via Bug reports for GNU grep <bug-grep@HIDDEN>:
> Most users consider a line at EOF lacking a trailing newline as still a line, but perhaps some do not?

Well, POSIX doesn't: https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_206

The definition may cause trouble with shell's read - e.g. when reading a file created on Windows with notepad where it is easy to accidentally create an incomplete line (compared to vi where I don't know an easy way).

Best regards,

Martin




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 23 Mar 2024 20:35:40 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 16:35:40 2024
Received: from localhost ([127.0.0.1]:52399 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ro85b-0002XX-Gy
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 16:35:40 -0400
Received: from lists.gnu.org ([209.51.188.17]:51090)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dclarke@HIDDEN>) id 1ro85K-0002WK-Lr
 for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 16:35:23 -0400
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 <dclarke@HIDDEN>)
 id 1ro7mC-0003Cg-E4
 for bug-grep@HIDDEN; Sat, 23 Mar 2024 16:15:36 -0400
Received: from mail.oetec.com ([108.160.241.186])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dclarke@HIDDEN>)
 id 1ro7mA-0002i9-TV
 for bug-grep@HIDDEN; Sat, 23 Mar 2024 16:15:36 -0400
Received: from [172.16.35.4]
 (cpe8c6a8d4d360a-cm8c6a8d4d3608.cpe.net.cable.rogers.com [99.253.151.152]
 (may be forged)) (authenticated bits=0)
 by mail.oetec.com (8.17.1/8.17.1) with ESMTPSA id 42NKFSSt012547
 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)
 for <bug-grep@HIDDEN>; Sat, 23 Mar 2024 16:15:29 -0400 (EDT)
 (envelope-from dclarke@HIDDEN)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blastwave.org;
 s=default; t=1711224929;
 bh=rz7a++I6SCzWfu8xMx8n6pXTpxBbo6jxr+KBsMT1YdI=;
 h=Date:Subject:To:References:From:In-Reply-To;
 b=Hpnaa6LsbqslbsaC09qBe/V9GWvzS8xpCBH88OsuD4AEwtn84/EhJMCMbk/JSCStO
 e6xCGew9oAg503Di6jZ0gtS++KMCkJILqYAsAXK2+Rhau9Y7z+LeH301NNx422AZTw
 dwigdnTlbvt3IokC3hAJollGAkCFl2ehbpKKMtIjsY6fb341204OHVLEufLV6/F3Pm
 vbUbJ3WqE3vFpz21PIWoPKvAgYuf4empNmyvYJYOoe3idPQCaSFhk8yQjqcuTtHcSs
 h6bLM95Pjn4I6cSDqValpsx/it6n8zeHlbFSMza/l7liSxoNtU9xtD2HtHtk0KawhI
 1muYmn+EplogQ==
Message-ID: <c52b41d1-3bec-43c2-ade5-2697bb6de20b@HIDDEN>
Date: Sat, 23 Mar 2024 16:15:28 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
Content-Language: en-CA
To: bug-grep@HIDDEN
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
From: Dennis Clarke <dclarke@HIDDEN>
Organization: GENUNIX
In-Reply-To: <1991478992.366613.1711140132607@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-oetec-MailScanner-Information: Please contact the ISP for more information
X-oetec-MailScanner-ID: 42NKFSSt012547
X-oetec-MailScanner: Found to be clean
X-oetec-MailScanner-From: dclarke@HIDDEN
X-Spam-Status: No
Received-SPF: pass client-ip=108.160.241.186;
 envelope-from=dclarke@HIDDEN; helo=mail.oetec.com
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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,
 RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
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: -2.3 (--)

On 3/22/24 16:42, David G. Pickett via Bug reports for GNU grep wrote:
 >
 > Most users consider a line at EOF lacking a trailing newline as
 > still a line, but perhaps some do not?
 >



Good ol "wc" says it is not a line.  I would go with what "wc" claims.



--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken





Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 23 Mar 2024 20:14:15 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sat Mar 23 16:14:15 2024
Received: from localhost ([127.0.0.1]:51327 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1ro7kt-0001gU-6F
	for submit <at> debbugs.gnu.org; Sat, 23 Mar 2024 16:14:15 -0400
Received: from mail.oetec.com ([108.160.241.186]:25336)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dclarke@HIDDEN>) id 1ro7kq-0001g7-Pt
 for 69929 <at> debbugs.gnu.org; Sat, 23 Mar 2024 16:14:13 -0400
Received: from [172.16.35.4]
 (cpe8c6a8d4d360a-cm8c6a8d4d3608.cpe.net.cable.rogers.com [99.253.151.152]
 (may be forged)) (authenticated bits=0)
 by mail.oetec.com (8.17.1/8.17.1) with ESMTPSA id 42NKD75j012492
 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT);
 Sat, 23 Mar 2024 16:13:13 -0400 (EDT)
 (envelope-from dclarke@HIDDEN)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blastwave.org;
 s=default; t=1711224794;
 bh=8PRjhm3gfB2CE6bu7jTr/diFhGzZK0Mk91Bxrstq+Pg=;
 h=Date:Subject:To:References:From:In-Reply-To;
 b=IshnvH8ziWYwD3A41qeVjDQbHIIZlfZdLjTj0HvVIHfx0ZIECw1wY8Of1k/H1cg5/
 XA0LduHAzg0qTmbbzoYBYxlKm+7O4LbU58rjgQzw4Lz0UKX1qocc1yWoBTEqZFqBmO
 HjUhjib9p/zBeVqm/ogm0jO6w3Zws8f+8ohWoniTugFVt0KNUZQ/TigKh0tXddsQrJ
 SowuvsrFHxbcahW7Nx136JEL43XQj/y+CZI0iSKV7rxHPAGnuCnkrLRev3ydiCN3LP
 jYiq9V+UsUO1/K0iayfmOto0Pivcv0e53ESoNWeKpHi+7kCTbdN+G6GLMiZmWUqkNV
 mX3Vmj/1kED+w==
Message-ID: <e1249dca-6ea3-4c90-adb8-d551c22038e7@HIDDEN>
Date: Sat, 23 Mar 2024 16:13:06 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
To: Paul Eggert <eggert@HIDDEN>, 69929 <at> debbugs.gnu.org
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <7d1c0d77-3582-4edd-b976-e8041ecc10bf@HIDDEN>
 <3b683016-950c-4fc0-8e0e-efaf2d18262e@HIDDEN>
 <f8d1a88c-b707-4683-85d5-9c4f8b0b3e64@HIDDEN>
Content-Language: en-CA
From: Dennis Clarke <dclarke@HIDDEN>
Organization: GENUNIX
In-Reply-To: <f8d1a88c-b707-4683-85d5-9c4f8b0b3e64@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-oetec-MailScanner-Information: Please contact the ISP for more information
X-oetec-MailScanner-ID: 42NKD75j012492
X-oetec-MailScanner: Found to be clean
X-oetec-MailScanner-From: dclarke@HIDDEN
X-Spam-Status: No
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69929
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: -3.3 (---)

On 3/22/24 17:12, Paul Eggert wrote:
> On 3/22/24 12:25, Dennis Clarke via Bug reports for GNU grep wrote:
>> Old Solaris 8, once fully patched, was definately
>> compliant with SUSv2 which is all of POSIX.1b-1993, POSIX.1c-1996
> 
> POSIX does not specify the behavior of grep when the input is not a text 
> file, and a file that ends in a non-newline is not a text file. So 
> Solaris grep and GNU grep can do what they like when the input ends in a 
> non-newline; they don't have to agree with each other.

re "a file that ends in a non-newline is not a text file" <-- really?

That is a new one on me. Regardless ... this is entirely a GNU sed
discussion so the comparison to some XPG4 grep from old old Solaris
is not really all that helpful. Sorry.


--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken





Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 21:29:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 17:29:19 2024
Received: from localhost ([127.0.0.1]:50611 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnmRy-0001uw-Vp
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 17:29:19 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:50154)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1rnmRx-0001uf-CL
 for 69929 <at> debbugs.gnu.org; Fri, 22 Mar 2024 17:29:18 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 72F8C3C00E410;
 Fri, 22 Mar 2024 14:12:24 -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 cFjJqluD7vTj; Fri, 22 Mar 2024 14:12:24 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 2C76E3C00E411;
 Fri, 22 Mar 2024 14:12:24 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 2C76E3C00E411
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1711141944;
 bh=OvRtbLvpaOuZY8j0ijtolQHy9b8q/ffKpc4e0ts05JQ=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=Zr7Bf157d//X7Bci29yjHWrQgEz9N+/N8+dnk8ockSVJUuhEUP61hSFvzmylrB+cc
 5AEkKJJaKijI1pIm+vABol5/d3WXLPTjS9ysPoQtoix7V1lSgqe2pdABgQuBzg3g4n
 00kGONR2kuK1ZfpPbUqqzJRqN4IPOtazNODZpmPkIe+4yJ61vJRteBdlDTkAEwsWh3
 lr0glVSbOtrFEcrRhTu5Rmn3Y/ka6sJ/ROWFrdz27Wzxgn3EnrjLmvD4qdkL81gbGA
 ITvYBXHih0riPGmcybzIkV+w2izAnMO5ATNvEwwi+KUSc88fC111+Efw5QoyIEKgTQ
 RTZB7mRPQcu5A==
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 4NUAD2qp4fzu; Fri, 22 Mar 2024 14:12:24 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 04E783C00E410;
 Fri, 22 Mar 2024 14:12:23 -0700 (PDT)
Message-ID: <f8d1a88c-b707-4683-85d5-9c4f8b0b3e64@HIDDEN>
Date: Fri, 22 Mar 2024 14:12:20 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
To: Dennis Clarke <dclarke@HIDDEN>, 69929 <at> debbugs.gnu.org
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <7d1c0d77-3582-4edd-b976-e8041ecc10bf@HIDDEN>
 <3b683016-950c-4fc0-8e0e-efaf2d18262e@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <3b683016-950c-4fc0-8e0e-efaf2d18262e@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69929
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 3/22/24 12:25, Dennis Clarke via Bug reports for GNU grep wrote:
> Old Solaris 8, once fully patched, was definately
> compliant with SUSv2 which is all of POSIX.1b-1993, POSIX.1c-1996

POSIX does not specify the behavior of grep when the input is not a text 
file, and a file that ends in a non-newline is not a text file. So 
Solaris grep and GNU grep can do what they like when the input ends in a 
non-newline; they don't have to agree with each other.




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 21:02:46 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 17:02:46 2024
Received: from localhost ([127.0.0.1]:48943 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnm2H-0000jR-CN
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 17:02:46 -0400
Received: from sonic320-24.consmr.mail.gq1.yahoo.com ([98.137.70.205]:33682)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dgpickett@HIDDEN>) id 1rnm2E-0000iv-TV
 for 69929 <at> debbugs.gnu.org; Fri, 22 Mar 2024 17:02:44 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1711141314; bh=iYpvBjlfs1Gx42yBrUq3Lkw7KhTKQ1dOIVX9MR60TDI=;
 h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To;
 b=Gi916VKieJRS04437cjMRIXpLsjfnkgYb+dQhIjThnHCUMWn8zdIW87hKFXC2P05bHfbeHn769X+xLzGOSUQz3eRbbgc5+jSXw7VhW1kz44beJVMO3Q45WIe7ew/9HwrNGFufJ8MxQu+3VhA7jI6/9tZAm1osPm3H2CMjhTbdR3eGPcyxah2PkALIuh9arfgYkUuSDHwkDtcWhK2zSHZMfn27ytDkj1Segc66lpgK2HAv4cPyraTwfix3MTMuAUub0fYfqruDAl0tLn6QYj+lk/ok92icGZ4Klg1zVVx703EXJciQfJVtix2GlsL+tk4hQqZ1590W3h3yEnNe+kSfg==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1711141314; bh=cVeDVuh5gs0/Ytk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C9Vei118fj2IKJmLwO2LPUwCDPDiIHI6DjYBSsRlDBsIw77k
 9J5Q4PXZSTq5CiQZp2G0w.4NiGAKgewS85Wzvg_AwjxNyE84_cemgG91E_FzgYxwoh.OQrbGua8v
 3NbRLUbLx3pg4NaHTuAT0uAMyF.KX29S6eqfR3xIILT8K0EQMKkDL0r4geVp_n0pTL0Jt.VFmFht
 IXO5Ai1AIXQ4k0LFUGm45IPGUVY0EtyRYptFmG1bWRyC.oBCQXP7LKvIMQqT7PApZ0AmERh1WgOq
 k4T2_xSgr04pDCDMqZMAW3JGOqv8Az_TtBzrToLqS.6EKoXGkxw2kOZLvxk94BTlxws9SkqHjHuf
 6BRAxbS69k8Qhw.id_G3cA8mB93kFZU6WaKkhw_CgJKnrb7uputjXyr9O8E1pfNFWQy3fGTVHdZE
 DTnqE9v0RLSjVEkukcHaL2vBcKWz5ZWunoEp0vfZIDSTaSV7mixIjy7zuhVPhDc37L4f7Tjn6dUZ
 wG89QkQDw2JKuQJ32VTHiOZaRGMjuly0zgZVKWhpFRMQ8a9NTpP7OqPIzbjspypAgimtgyUU.1Ph
 q8n_0rmMpb_TgqglgLAqOYw--
X-Sonic-MF: <dgpickett@HIDDEN>
X-Sonic-ID: e4a23e01-b887-4f3f-bf04-5516c56f5598
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic320.consmr.mail.gq1.yahoo.com with HTTP; Fri, 22 Mar 2024 21:01:54 +0000
Date: Fri, 22 Mar 2024 21:01:49 +0000 (UTC)
From: "David G. Pickett" <dgpickett@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>, 
 =?UTF-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>
Message-ID: <1098252559.372593.1711141309674@HIDDEN>
In-Reply-To: <1991478992.366613.1711140132607@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
 <1991478992.366613.1711140132607@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_372592_2097052084.1711141309673"
X-Mailer: WebService/1.1.22205 AolMailNorrin
Content-Length: 10537
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69929
Cc: "69929 <at> debbugs.gnu.org" <69929 <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 (-)

------=_Part_372592_2097052084.1711141309673
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 $ (echo -n foo;sleep 10;echo bar)|time sh -c '(grep -q foo;echo $?)'00.00u=
ser 0.00system 0:10.00elapsed 0%CPU (0avgtext+0avgdata 2432maxresident)k0in=
puts+0outputs (0major+202minor)pagefaults 0swaps$ (echo -n foo;sleep 10)|ti=
me sh -c '(grep -q foo;echo $?)'00.00user 0.00system 0:10.00elapsed 0%CPU (=
0avgtext+0avgdata 2432maxresident)k0inputs+0outputs (0major+202minor)pagefa=
ults 0swaps$

    On Friday, March 22, 2024 at 04:43:56 PM EDT, David G. Pickett" via Bug=
 reports for GNU grep <bug-grep@HIDDEN> wrote: =20
=20
  Maybe the opposite: -only_lines_with_newline ? Most users consider a line=
 at EOF lacking a trailing newline as still a line, but perhaps some do not=
?
=C2=A0 =C2=A0 On Friday, March 22, 2024 at 04:25:38 AM EDT, Niels M=C3=B6ll=
er <nisse@HIDDEN> wrote:=C2=A0=20
=20
 Paul Eggert <eggert@HIDDEN> writes:

> On 3/21/24 06:57, Niels M=C3=B6ller wrote:
>> I'm having grep -q read input from a pipe. I would like grep to exit
>> successfully as soon as a match occurs, without requiring the line to be
>> terminated by newline or EOF (unless the grep pattern includes '$', that
>> is).
>
> Grep used to behave almost that way. It did wait for a newline but it
> did not wait for EOF. But people started complaining about that
> behavior so we changed it.

Some --exit-early option? Sounds reasonable, but not enough for my
usecase. And I understand it might be an undesirable default behavior of
-q: Not so nice if changing "foo | grep" to "foo | grep -q" could make
foo fail with EPIPE/SIGPIPE.

(BTW, man page says about the -q option "Exit immediately with zero
status if any match is found", from reading that, I would not expect
grep to continue to read the rest of the file until EOF).

> However, not waiting for a newline is problematic; although doable it
> would be a bit of a pain to program and not sure it's worth the
> effort. Grep didn't used to do that.

I only have a rather abstract understanding of regexp matching, but for
patterns that aren't extended to require backtracking, in principle it
should be doably to feed the state machine one character at a time, with
no buffering of input?

jackson@HIDDEN writes:

> If you're not sure whether your actual input of interest will end
> in a newline, can you add one, to "feed grep's newline hunger",
> thus for instance replacing your example:
>
>=C2=A0 grep -q foo <(sh -c 'printf foo ; sleep 30' &)
>
> with:
>
>=C2=A0 grep -q foo <(sh -c 'printf foo ; echo ; sleep 30' &)

Not so easy when the input is the log output by a still running process
(in my case qemu).

> In any case, grep is quite line oriented,

Right. Maybe what I'm really looking for is a binary grep. For the time
being, I hacked together a tool that does just what I need for my qemu
test (no regexp matching, just matching a fix string starting at the
beginning of a line). See
https://git.glasklar.is/system-transparency/core/stboot/-/blob/43e91273a574=
73ee361e332926b88c1b4fe9917a/integration/look-for/look-for.go

I use this in combination with timeout (GNU coreutils) to fail the test
if no match for the login prompt is found within reasonable time.

A more general binary grep could match a regexp against a binary file or
stream, with options to exit on first match (my immediate usecase),
output the count of matches, or output the positions for each match. I
still think some of those features would make sense as part of GNU grep.

Regards,
/Niels

--=20
Niels M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.



=C2=A0=20
 =20
------=_Part_372592_2097052084.1711141309673
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"ydp1d981aa1yahoo-style-wrap" style=
=3D"font-family:Verdana, Arial, Helvetica, sans-serif;font-size:16px;"><div=
></div>
        <div><div><div dir=3D"ltr" data-setdir=3D"false">$ (echo -n foo;sle=
ep 10;echo bar)|time sh -c '(grep -q foo;echo $?)'</div><div>0</div><div>0.=
00user 0.00system 0:10.00elapsed 0%CPU (0avgtext+0avgdata 2432maxresident)k=
</div><div>0inputs+0outputs (0major+202minor)pagefaults 0swaps</div><div>$ =
(echo -n foo;sleep 10)|time sh -c '(grep -q foo;echo $?)'</div><div>0</div>=
<div>0.00user 0.00system 0:10.00elapsed 0%CPU (0avgtext+0avgdata 2432maxres=
ident)k</div><div>0inputs+0outputs (0major+202minor)pagefaults 0swaps</div>=
<div>$</div></div><br></div><div><br></div>
       =20
        </div><div id=3D"ydpbcaf6ce1yahoo_quoted_2128164301" class=3D"ydpbc=
af6ce1yahoo_quoted">
            <div style=3D"font-family:'Helvetica Neue', Helvetica, Arial, s=
ans-serif;font-size:13px;color:#26282a;">
               =20
                <div>
                        On Friday, March 22, 2024 at 04:43:56 PM EDT, David=
 G. Pickett" via Bug reports for GNU grep &lt;bug-grep@HIDDEN&gt; wrote:
                    </div>
                    <div><br></div>
                    <div><br></div>
               =20
               =20
                <div><div dir=3D"ltr"> Maybe the opposite: -only_lines_with=
_newline ? Most users consider a line at EOF lacking a trailing newline as =
still a line, but perhaps some do not?<div class=3D"ydpbcaf6ce1yqt489726980=
8" id=3D"ydpbcaf6ce1yqtfd44453"><br clear=3D"none">&nbsp; &nbsp; On Friday,=
 March 22, 2024 at 04:25:38 AM EDT, Niels M=C3=B6ller &lt;<a shape=3D"rect"=
 href=3D"mailto:nisse@HIDDEN" rel=3D"nofollow" target=3D"_blank">ni=
sse@HIDDEN</a>&gt; wrote:&nbsp; <br clear=3D"none"> <br clear=3D"no=
ne"> Paul Eggert &lt;<a shape=3D"rect" href=3D"mailto:eggert@HIDDEN" r=
el=3D"nofollow" target=3D"_blank">eggert@HIDDEN</a>&gt; writes:<br cle=
ar=3D"none"><br clear=3D"none">&gt; On 3/21/24 06:57, Niels M=C3=B6ller wro=
te:<br clear=3D"none">&gt;&gt; I'm having grep -q read input from a pipe. I=
 would like grep to exit<br clear=3D"none">&gt;&gt; successfully as soon as=
 a match occurs, without requiring the line to be<br clear=3D"none">&gt;&gt=
; terminated by newline or EOF (unless the grep pattern includes '$', that<=
br clear=3D"none">&gt;&gt; is).<br clear=3D"none">&gt;<br clear=3D"none">&g=
t; Grep used to behave almost that way. It did wait for a newline but it<br=
 clear=3D"none">&gt; did not wait for EOF. But people started complaining a=
bout that<br clear=3D"none">&gt; behavior so we changed it.<br clear=3D"non=
e"><br clear=3D"none">Some --exit-early option? Sounds reasonable, but not =
enough for my<br clear=3D"none">usecase. And I understand it might be an un=
desirable default behavior of<br clear=3D"none">-q: Not so nice if changing=
 "foo | grep" to "foo | grep -q" could make<br clear=3D"none">foo fail with=
 EPIPE/SIGPIPE.<br clear=3D"none"><br clear=3D"none">(BTW, man page says ab=
out the -q option "Exit immediately with zero<br clear=3D"none">status if a=
ny match is found", from reading that, I would not expect<br clear=3D"none"=
>grep to continue to read the rest of the file until EOF).<br clear=3D"none=
"><br clear=3D"none">&gt; However, not waiting for a newline is problematic=
; although doable it<br clear=3D"none">&gt; would be a bit of a pain to pro=
gram and not sure it's worth the<br clear=3D"none">&gt; effort. Grep didn't=
 used to do that.<br clear=3D"none"><br clear=3D"none">I only have a rather=
 abstract understanding of regexp matching, but for<br clear=3D"none">patte=
rns that aren't extended to require backtracking, in principle it<br clear=
=3D"none">should be doably to feed the state machine one character at a tim=
e, with<br clear=3D"none">no buffering of input?<br clear=3D"none"><br clea=
r=3D"none"><a shape=3D"rect" href=3D"mailto:jackson@HIDDEN" rel=3D"no=
follow" target=3D"_blank">jackson@HIDDEN</a> writes:<br clear=3D"none=
"><br clear=3D"none">&gt; If you're not sure whether your actual input of i=
nterest will end<br clear=3D"none">&gt; in a newline, can you add one, to "=
feed grep's newline hunger",<br clear=3D"none">&gt; thus for instance repla=
cing your example:<br clear=3D"none">&gt;<br clear=3D"none">&gt;&nbsp; grep=
 -q foo &lt;(sh -c 'printf foo ; sleep 30' &amp;)<br clear=3D"none">&gt;<br=
 clear=3D"none">&gt; with:<br clear=3D"none">&gt;<br clear=3D"none">&gt;&nb=
sp; grep -q foo &lt;(sh -c 'printf foo ; echo ; sleep 30' &amp;)<br clear=
=3D"none"><br clear=3D"none">Not so easy when the input is the log output b=
y a still running process<br clear=3D"none">(in my case qemu).<br clear=3D"=
none"><br clear=3D"none">&gt; In any case, grep is quite line oriented,<br =
clear=3D"none"><br clear=3D"none">Right. Maybe what I'm really looking for =
is a binary grep. For the time<br clear=3D"none">being, I hacked together a=
 tool that does just what I need for my qemu<br clear=3D"none">test (no reg=
exp matching, just matching a fix string starting at the<br clear=3D"none">=
beginning of a line). See<br clear=3D"none"><a shape=3D"rect" href=3D"https=
://git.glasklar.is/system-transparency/core/stboot/-/blob/43e91273a57473ee3=
61e332926b88c1b4fe9917a/integration/look-for/look-for.go" rel=3D"nofollow" =
target=3D"_blank" fg_scanned=3D"1" fg_rewritten=3D"1">https://git.glasklar.=
is/system-transparency/core/stboot/-/blob/43e91273a57473ee361e332926b88c1b4=
fe9917a/integration/look-for/look-for.go</a><br clear=3D"none"><br clear=3D=
"none">I use this in combination with timeout (GNU coreutils) to fail the t=
est<br clear=3D"none">if no match for the login prompt is found within reas=
onable time.<br clear=3D"none"><br clear=3D"none">A more general binary gre=
p could match a regexp against a binary file or<br clear=3D"none">stream, w=
ith options to exit on first match (my immediate usecase),<br clear=3D"none=
">output the count of matches, or output the positions for each match. I<br=
 clear=3D"none">still think some of those features would make sense as part=
 of GNU grep.<br clear=3D"none"><br clear=3D"none">Regards,<br clear=3D"non=
e">/Niels<br clear=3D"none"><br clear=3D"none">-- <br clear=3D"none">Niels =
M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.<br clear=3D"=
none">Internet email is subject to wholesale government surveillance.<br cl=
ear=3D"none"><br clear=3D"none"><br clear=3D"none"><br clear=3D"none">&nbsp=
; <br clear=3D"none"></div></div></div>
            </div>
        </div></body></html>
------=_Part_372592_2097052084.1711141309673--




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 20:55:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 16:55:16 2024
Received: from localhost ([127.0.0.1]:48439 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnlv2-00062C-1c
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 16:55:16 -0400
Received: from sonic310-21.consmr.mail.gq1.yahoo.com ([98.137.69.147]:37425)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dgpickett@HIDDEN>) id 1rnlux-00061f-6n
 for 69929 <at> debbugs.gnu.org; Fri, 22 Mar 2024 16:55:14 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1711140862; bh=3vJamkX5ouMWOk2yeT+0efebVS49Kk9BbUFz8kV6bQw=;
 h=Date:From:To:In-Reply-To:References:Subject:From:Subject:Reply-To;
 b=jGTvlkV6Y94Dx46wVD4V44ErOrEp2RZZj0rcih61Dxr/pRo9sP1uZ11tI7/VzmH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Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic310.consmr.mail.gq1.yahoo.com with HTTP; Fri, 22 Mar 2024 20:54:22 +0000
Date: Fri, 22 Mar 2024 20:34:19 +0000 (UTC)
From: "David G. Pickett" <dgpickett@HIDDEN>
To: "69929 <at> debbugs.gnu.org" <69929 <at> debbugs.gnu.org>, 
 =?UTF-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>
Message-ID: <325905636.364347.1711139659582@HIDDEN>
In-Reply-To: <cpfjzlviq5i.fsf@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <cpfjzlviq5i.fsf@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_364346_1004816287.1711139659581"
X-Mailer: WebService/1.1.22205 AolMailNorrin
Content-Length: 4243
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69929
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 (-)

------=_Part_364346_1004816287.1711139659581
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

  $ (echo foo;sleep 10;echo bar)|time grep -q foo;echo $?0.00user 0.00syste=
m 0:00.00elapsed 50%CPU (0avgtext+0avgdata 2432maxresident)k0inputs+0output=
s (0major+107minor)pagefaults 0swaps0$=C2=A0=C2=A0

The shell hangs for 10 seconds on its child pids but grep does not!
    On Thursday, March 21, 2024 at 11:03:49 AM EDT, Niels M=C3=B6ller <niss=
e@HIDDEN> wrote: =20
=20
 Niels M=C3=B6ller <nisse@HIDDEN> writes:

> E.g., if I run=20
>
>=C2=A0 (printf foo ; sleep 30) | grep -q foo
>
> I want grep to exit successfully right away. Currently, grep waits until
> it gets EOF on the input, 30 seconds later.

Sorry if I'm confused about how to script this. The following (bash
syntax) is a better example:

=C2=A0 grep -q foo <(sh -c 'printf foo ; sleep 30' &)

This blocks 30 seconds before exiting. In contrast,=20

=C2=A0 grep -q foo <(sh -c echo foo ; sleep 30' &)

(only difference is the newline at the end of the line) does exit
immediately.

Regards,
/Niels

--=20
Niels M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.



 =20
------=_Part_364346_1004816287.1711139659581
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"ydpfbde170byahoo-style-wrap" style=
=3D"font-family:Verdana, Arial, Helvetica, sans-serif;font-size:16px;"><div=
></div>
        <div dir=3D"ltr" data-setdir=3D"false"><div><div dir=3D"ltr" data-s=
etdir=3D"false"> <div><div>$ (echo foo;sleep 10;echo bar)|time grep -q foo;=
echo $?</div><div>0.00user 0.00system 0:00.00elapsed 50%CPU (0avgtext+0avgd=
ata 2432maxresident)k</div><div>0inputs+0outputs (0major+107minor)pagefault=
s 0swaps</div><div>0</div><div>$&nbsp;</div></div>&nbsp;<br></div><div><br>=
</div></div>The shell hangs for 10 seconds on its child pids but grep does =
not!</div><div><br></div>
       =20
        </div><div id=3D"ydpffc77d87yahoo_quoted_1302395481" class=3D"ydpff=
c77d87yahoo_quoted">
            <div style=3D"font-family:'Helvetica Neue', Helvetica, Arial, s=
ans-serif;font-size:13px;color:#26282a;">
               =20
                <div>
                        On Thursday, March 21, 2024 at 11:03:49 AM EDT, Nie=
ls M=C3=B6ller &lt;nisse@HIDDEN&gt; wrote:
                    </div>
                    <div><br></div>
                    <div><br></div>
               =20
               =20
                <div><div dir=3D"ltr">Niels M=C3=B6ller &lt;<a shape=3D"rec=
t" href=3D"mailto:nisse@HIDDEN" rel=3D"nofollow" target=3D"_blank">=
nisse@HIDDEN</a>&gt; writes:<br clear=3D"none"><br clear=3D"none">&=
gt; E.g., if I run <br clear=3D"none">&gt;<br clear=3D"none">&gt;&nbsp;  (p=
rintf foo ; sleep 30) | grep -q foo<br clear=3D"none">&gt;<br clear=3D"none=
">&gt; I want grep to exit successfully right away. Currently, grep waits u=
ntil<br clear=3D"none">&gt; it gets EOF on the input, 30 seconds later.<br =
clear=3D"none"><br clear=3D"none">Sorry if I'm confused about how to script=
 this. The following (bash<br clear=3D"none">syntax) is a better example:<b=
r clear=3D"none"><br clear=3D"none">&nbsp; grep -q foo &lt;(sh -c 'printf f=
oo ; sleep 30' &amp;)<br clear=3D"none"><br clear=3D"none">This blocks 30 s=
econds before exiting. In contrast, <br clear=3D"none"><br clear=3D"none">&=
nbsp; grep -q foo &lt;(sh -c echo foo ; sleep 30' &amp;)<br clear=3D"none">=
<br clear=3D"none">(only difference is the newline at the end of the line) =
does exit<br clear=3D"none">immediately.<div class=3D"ydpffc77d87yqt4235990=
220" id=3D"ydpffc77d87yqtfd03832"><br clear=3D"none"><br clear=3D"none">Reg=
ards,<br clear=3D"none">/Niels<br clear=3D"none"><br clear=3D"none">-- <br =
clear=3D"none">Niels M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF3=
68C6677.<br clear=3D"none">Internet email is subject to wholesale governmen=
t surveillance.<br clear=3D"none"><br clear=3D"none"><br clear=3D"none"><br=
 clear=3D"none"></div></div></div>
            </div>
        </div></body></html>
------=_Part_364346_1004816287.1711139659581--




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 20:43:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 16:43:11 2024
Received: from localhost ([127.0.0.1]:47648 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnljK-0002eA-56
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 16:43:11 -0400
Received: from sonic310-21.consmr.mail.gq1.yahoo.com ([98.137.69.147]:39078)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dgpickett@HIDDEN>) id 1rnljD-0002dF-Es
 for 69929 <at> debbugs.gnu.org; Fri, 22 Mar 2024 16:43:07 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aol.com; s=a2048;
 t=1711140133; bh=zEFUjfOvi+v6zWPaZsN4o3K73l9222wDiqi7BsW/pBk=;
 h=Date:From:To:Cc:In-Reply-To:References:Subject:From:Subject:Reply-To;
 b=hy20zIr7DBGwAkr9FTab8ylwYwNo7qlS5bLrfXExQCQcKU+Rr0oa6njgEhpXXlaZ0yQBN+Q8Y+2YMTibYZxF8dPcBxrwPOu+adsOnqbNizJb/CK/On7OW3s/A273S+CXimV9Sii8TIFqsdEXjfZpZNvGoVzo4hk14TkwSbooARQdcQAGvdZOzcTzUmc6FqOO26AuBsW83hc6uN9NXnQ8e8W4YIcgSp2kDePUgJhEc0EBt0I+9VODYJy9Z2edY/g8KeQ06jPllHxQSLKOKi4oL2AcXb19WF7B5M4+qE9AgkfKeHOB2DHbx+8sdeYi6VmVGQhsQg1T3lDygJ4ZJc8nXA==
X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048;
 t=1711140133; bh=iQVyYM8DUMgrBzX5xcm5UT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_jRc325QCtB3gweFb_gg3IAxJSmWyTl
 6I1is9WYkk_bk7J8aynBoHU3WqJBPBrD5nNnbh2_svoky_NLYUpbb8kznnezoZtFuWrn77mdh4b_
 0SLL0TRfIfEWpFhyQWSSJtIFh11h425y5L8UFJJIO0Q.QzJhkRh1PSzA4y8IQ0a.6n4h9I2pgqf2
 VqT5Xqh9CIXx3NXx_vrzIS0bUPPsFpR9HdobOtts8vtVitHd_dRp1n0Kj.o1cSjuz3ZY04OYDkRt
 EZs0LGygJnmD9nb.lfnkWBXgIQXtNlN3eijRGUEKWAR.3PzpSGmvRwkuRnw657cgd1uk4BXRn9Ds
 BMrtPeI6KL2yqIXs12jtC8c1G8lGq5exgeTEtodXpELtG2XwxrVhvo3bP1tneGe90uW8Pavp5qx_
 2dkcgpbdhZTBbn3q1Q74hswxADHRAmps7MdQ2ac7hv.IpTti6kL5Sm3lcPSl0ElxM2CmSFAqHSRg
 oEAEdpIap7i650BtUGD1.TtdJmuQf7UO5K6cugSvX9xqQk2I3ZvkFALygBbvEAKM3v1xOeps6xXq
 yW12UUT9IDhuVCCJtrXk8fGeydiF_mEr9eQygM3mJQQ58iuTIoDZmDQ--
X-Sonic-MF: <dgpickett@HIDDEN>
X-Sonic-ID: 74cbea81-dd01-4be5-86f8-c3096e801a48
Received: from sonic.gate.mail.ne1.yahoo.com by
 sonic310.consmr.mail.gq1.yahoo.com with HTTP; Fri, 22 Mar 2024 20:42:13 +0000
Date: Fri, 22 Mar 2024 20:42:12 +0000 (UTC)
From: "David G. Pickett" <dgpickett@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>, 
 =?UTF-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>
Message-ID: <1991478992.366613.1711140132607@HIDDEN>
In-Reply-To: <cpffrwiishz.fsf@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
MIME-Version: 1.0
Content-Type: multipart/alternative; 
 boundary="----=_Part_366612_425286224.1711140132605"
X-Mailer: WebService/1.1.22205 AolMailNorrin
Content-Length: 9206
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69929
Cc: "69929 <at> debbugs.gnu.org" <69929 <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 (-)

------=_Part_366612_425286224.1711140132605
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

 Maybe the opposite: -only_lines_with_newline ? Most users consider a line =
at EOF lacking a trailing newline as still a line, but perhaps some do not?
    On Friday, March 22, 2024 at 04:25:38 AM EDT, Niels M=C3=B6ller <nisse@=
lysator.liu.se> wrote: =20
=20
 Paul Eggert <eggert@HIDDEN> writes:

> On 3/21/24 06:57, Niels M=C3=B6ller wrote:
>> I'm having grep -q read input from a pipe. I would like grep to exit
>> successfully as soon as a match occurs, without requiring the line to be
>> terminated by newline or EOF (unless the grep pattern includes '$', that
>> is).
>
> Grep used to behave almost that way. It did wait for a newline but it
> did not wait for EOF. But people started complaining about that
> behavior so we changed it.

Some --exit-early option? Sounds reasonable, but not enough for my
usecase. And I understand it might be an undesirable default behavior of
-q: Not so nice if changing "foo | grep" to "foo | grep -q" could make
foo fail with EPIPE/SIGPIPE.

(BTW, man page says about the -q option "Exit immediately with zero
status if any match is found", from reading that, I would not expect
grep to continue to read the rest of the file until EOF).

> However, not waiting for a newline is problematic; although doable it
> would be a bit of a pain to program and not sure it's worth the
> effort. Grep didn't used to do that.

I only have a rather abstract understanding of regexp matching, but for
patterns that aren't extended to require backtracking, in principle it
should be doably to feed the state machine one character at a time, with
no buffering of input?

jackson@HIDDEN writes:

> If you're not sure whether your actual input of interest will end
> in a newline, can you add one, to "feed grep's newline hunger",
> thus for instance replacing your example:
>
>=C2=A0 grep -q foo <(sh -c 'printf foo ; sleep 30' &)
>
> with:
>
>=C2=A0 grep -q foo <(sh -c 'printf foo ; echo ; sleep 30' &)

Not so easy when the input is the log output by a still running process
(in my case qemu).

> In any case, grep is quite line oriented,

Right. Maybe what I'm really looking for is a binary grep. For the time
being, I hacked together a tool that does just what I need for my qemu
test (no regexp matching, just matching a fix string starting at the
beginning of a line). See
https://git.glasklar.is/system-transparency/core/stboot/-/blob/43e91273a574=
73ee361e332926b88c1b4fe9917a/integration/look-for/look-for.go

I use this in combination with timeout (GNU coreutils) to fail the test
if no match for the login prompt is found within reasonable time.

A more general binary grep could match a regexp against a binary file or
stream, with options to exit on first match (my immediate usecase),
output the count of matches, or output the positions for each match. I
still think some of those features would make sense as part of GNU grep.

Regards,
/Niels

--=20
Niels M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.



 =20
------=_Part_366612_425286224.1711140132605
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<html><head></head><body><div class=3D"ydp2d6dc6a8yahoo-style-wrap" style=
=3D"font-family:Verdana, Arial, Helvetica, sans-serif;font-size:16px;"><div=
></div>
        <div dir=3D"ltr" data-setdir=3D"false">Maybe the opposite: -only_li=
nes_with_newline ? Most users consider a line at EOF lacking a trailing new=
line as still a line, but perhaps some do not?</div><div><br></div>
       =20
        </div><div id=3D"ydpc2a08418yahoo_quoted_1342462060" class=3D"ydpc2=
a08418yahoo_quoted">
            <div style=3D"font-family:'Helvetica Neue', Helvetica, Arial, s=
ans-serif;font-size:13px;color:#26282a;">
               =20
                <div>
                        On Friday, March 22, 2024 at 04:25:38 AM EDT, Niels=
 M=C3=B6ller &lt;nisse@HIDDEN&gt; wrote:
                    </div>
                    <div><br></div>
                    <div><br></div>
               =20
               =20
                <div><div dir=3D"ltr">Paul Eggert &lt;<a shape=3D"rect" hre=
f=3D"mailto:eggert@HIDDEN" rel=3D"nofollow" target=3D"_blank">eggert@c=
s.ucla.edu</a>&gt; writes:<br clear=3D"none"><br clear=3D"none">&gt; On 3/2=
1/24 06:57, Niels M=C3=B6ller wrote:<br clear=3D"none">&gt;&gt; I'm having =
grep -q read input from a pipe. I would like grep to exit<br clear=3D"none"=
>&gt;&gt; successfully as soon as a match occurs, without requiring the lin=
e to be<br clear=3D"none">&gt;&gt; terminated by newline or EOF (unless the=
 grep pattern includes '$', that<br clear=3D"none">&gt;&gt; is).<br clear=
=3D"none">&gt;<br clear=3D"none">&gt; Grep used to behave almost that way. =
It did wait for a newline but it<br clear=3D"none">&gt; did not wait for EO=
F. But people started complaining about that<br clear=3D"none">&gt; behavio=
r so we changed it.<br clear=3D"none"><br clear=3D"none">Some --exit-early =
option? Sounds reasonable, but not enough for my<br clear=3D"none">usecase.=
 And I understand it might be an undesirable default behavior of<br clear=
=3D"none">-q: Not so nice if changing "foo | grep" to "foo | grep -q" could=
 make<br clear=3D"none">foo fail with EPIPE/SIGPIPE.<br clear=3D"none"><br =
clear=3D"none">(BTW, man page says about the -q option "Exit immediately wi=
th zero<br clear=3D"none">status if any match is found", from reading that,=
 I would not expect<br clear=3D"none">grep to continue to read the rest of =
the file until EOF).<br clear=3D"none"><br clear=3D"none">&gt; However, not=
 waiting for a newline is problematic; although doable it<br clear=3D"none"=
>&gt; would be a bit of a pain to program and not sure it's worth the<br cl=
ear=3D"none">&gt; effort. Grep didn't used to do that.<br clear=3D"none"><b=
r clear=3D"none">I only have a rather abstract understanding of regexp matc=
hing, but for<br clear=3D"none">patterns that aren't extended to require ba=
cktracking, in principle it<br clear=3D"none">should be doably to feed the =
state machine one character at a time, with<br clear=3D"none">no buffering =
of input?<br clear=3D"none"><br clear=3D"none"><a shape=3D"rect" href=3D"ma=
ilto:jackson@HIDDEN" rel=3D"nofollow" target=3D"_blank">jackson@fastm=
ail.com</a> writes:<br clear=3D"none"><br clear=3D"none">&gt; If you're not=
 sure whether your actual input of interest will end<br clear=3D"none">&gt;=
 in a newline, can you add one, to "feed grep's newline hunger",<br clear=
=3D"none">&gt; thus for instance replacing your example:<br clear=3D"none">=
&gt;<br clear=3D"none">&gt;&nbsp;  grep -q foo &lt;(sh -c 'printf foo ; sle=
ep 30' &amp;)<br clear=3D"none">&gt;<br clear=3D"none">&gt; with:<br clear=
=3D"none">&gt;<br clear=3D"none">&gt;&nbsp;  grep -q foo &lt;(sh -c 'printf=
 foo ; echo ; sleep 30' &amp;)<br clear=3D"none"><br clear=3D"none">Not so =
easy when the input is the log output by a still running process<br clear=
=3D"none">(in my case qemu).<br clear=3D"none"><br clear=3D"none">&gt; In a=
ny case, grep is quite line oriented,<br clear=3D"none"><br clear=3D"none">=
Right. Maybe what I'm really looking for is a binary grep. For the time<br =
clear=3D"none">being, I hacked together a tool that does just what I need f=
or my qemu<br clear=3D"none">test (no regexp matching, just matching a fix =
string starting at the<br clear=3D"none">beginning of a line). See<br clear=
=3D"none"><a shape=3D"rect" href=3D"https://git.glasklar.is/system-transpar=
ency/core/stboot/-/blob/43e91273a57473ee361e332926b88c1b4fe9917a/integratio=
n/look-for/look-for.go" rel=3D"nofollow" target=3D"_blank" fg_scanned=3D"1"=
 fg_rewritten=3D"1">https://git.glasklar.is/system-transparency/core/stboot=
/-/blob/43e91273a57473ee361e332926b88c1b4fe9917a/integration/look-for/look-=
for.go</a><br clear=3D"none"><br clear=3D"none">I use this in combination w=
ith timeout (GNU coreutils) to fail the test<br clear=3D"none">if no match =
for the login prompt is found within reasonable time.<br clear=3D"none"><br=
 clear=3D"none">A more general binary grep could match a regexp against a b=
inary file or<br clear=3D"none">stream, with options to exit on first match=
 (my immediate usecase),<br clear=3D"none">output the count of matches, or =
output the positions for each match. I<br clear=3D"none">still think some o=
f those features would make sense as part of GNU grep.<br clear=3D"none"><b=
r clear=3D"none">Regards,<div class=3D"ydpc2a08418yqt9521716873" id=3D"ydpc=
2a08418yqtfd83209"><br clear=3D"none">/Niels</div><br clear=3D"none"><br cl=
ear=3D"none">-- <br clear=3D"none">Niels M=C3=B6ller. PGP key CB4962D070D77=
D7FCB8BA36271D8F1FF368C6677.<br clear=3D"none">Internet email is subject to=
 wholesale government surveillance.<div class=3D"ydpc2a08418yqt9521716873" =
id=3D"ydpc2a08418yqtfd14238"><br clear=3D"none"><br clear=3D"none"><br clea=
r=3D"none"><br clear=3D"none"></div></div></div>
            </div>
        </div></body></html>
------=_Part_366612_425286224.1711140132605--




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 22 Mar 2024 19:26:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 15:26:22 2024
Received: from localhost ([127.0.0.1]:43377 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnkWz-0007i6-7n
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 15:26:22 -0400
Received: from lists.gnu.org ([209.51.188.17]:47382)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <dclarke@HIDDEN>) id 1rnkWw-0007hp-Kj
 for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 15:26:19 -0400
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 <dclarke@HIDDEN>)
 id 1rnkWD-0003pN-5Q
 for bug-grep@HIDDEN; Fri, 22 Mar 2024 15:25:33 -0400
Received: from mail.oetec.com ([108.160.241.186])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <dclarke@HIDDEN>)
 id 1rnkWA-0001it-Q0
 for bug-grep@HIDDEN; Fri, 22 Mar 2024 15:25:32 -0400
Received: from [172.16.35.4]
 (cpe8c6a8d4d360a-cm8c6a8d4d3608.cpe.net.cable.rogers.com [99.253.151.152]
 (may be forged)) (authenticated bits=0)
 by mail.oetec.com (8.17.1/8.17.1) with ESMTPSA id 42MJPFKW077694
 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT)
 for <bug-grep@HIDDEN>; Fri, 22 Mar 2024 15:25:22 -0400 (EDT)
 (envelope-from dclarke@HIDDEN)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=blastwave.org;
 s=default; t=1711135522;
 bh=KiqgfHwuDpIQEFYOXnJJSLaor4gCpOa7TKMS7/WptwE=;
 h=Date:Subject:To:References:From:In-Reply-To;
 b=mK9Unmh39Tq1T4neYDryQsBFpng1ijPYIKsZoBqB/gQo8tOLmt+Jc7rICBvT2Ytm1
 fVeK04LLWBm8Uwsnt3i6LynnKG04qZOGPms146UDGkL8U0zlmfbLLJdpAVtHrMshYI
 D3nlCAcvZGRXCnXH3oD+E5YHMDVaAZnLMplbcG+Vfw0tU1vC8+viCLeUFsglTWmCR4
 7EpMI+0SsKFgWeD+g+Uda/O+bfKZYxqHDUxtMlX1JSa/CvjaqrCehhqiKQAX7+VF43
 5/cfxwWuj89cTDQSjIydkvuoc5Rq3TmYQ7ErNqBf6T6CusDiRlGjiiRvbFBYOuh/9w
 YrKGiXF4y036Q==
Message-ID: <3b683016-950c-4fc0-8e0e-efaf2d18262e@HIDDEN>
Date: Fri, 22 Mar 2024 15:25:15 -0400
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
To: bug-grep@HIDDEN
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <7d1c0d77-3582-4edd-b976-e8041ecc10bf@HIDDEN>
Content-Language: en-CA
From: Dennis Clarke <dclarke@HIDDEN>
Organization: GENUNIX
In-Reply-To: <7d1c0d77-3582-4edd-b976-e8041ecc10bf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-oetec-MailScanner-Information: Please contact the ISP for more information
X-oetec-MailScanner-ID: 42MJPFKW077694
X-oetec-MailScanner: Found to be clean
X-oetec-MailScanner-From: dclarke@HIDDEN
X-Spam-Status: No
Received-SPF: pass client-ip=108.160.241.186;
 envelope-from=dclarke@HIDDEN; helo=mail.oetec.com
X-Spam_score_int: -43
X-Spam_score: -4.4
X-Spam_bar: ----
X-Spam_report: (-4.4 / 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,
 RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: 0.9 (/)
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: -2.3 (--)

On 3/21/24 22:58, jackson@HIDDEN wrote:
 > Paul Eggert wrote:
 >> although doable it would be a bit of a pain to program
 >
 > yup - sure would be a pain.
 >
 > If you're not sure whether your actual input of interest will end
 > in a newline, can you add one, to "feed grep's newline hunger",
 > thus for instance replacing your example:
 >
 >    grep -q foo <(sh -c 'printf foo ; sleep 30' &)
 >
 > with:
 >
 >    grep -q foo <(sh -c 'printf foo ; echo ; sleep 30' &)
 >
 > In any case, grep is quite line oriented, as implied by an early
 > sentence in the man page grep(1):
 >
 > "PATTERNS is one or more patterns separated by newline characters,"
 >
     This may not be helpful but I powered up and old old Sun server
running Solaris 8 where I see :

nix$ uname -a
SunOS nix 5.8 Generic_117350-62 sun4m sparc SUNW,SPARCstation-20

nix$ cat /etc/release
                        Solaris 8 2/04 s28s_hw4wos_05a SPARC
            Copyright 2004 Sun Microsystems, Inc.  All Rights Reserved.
                             Assembled 08 January 2004

nix$ which grep
/usr/xpg4/bin/grep

nix$ /usr/bin/printf "This is a line of text without a newline" | wc
        0       9      40

nix$ /usr/bin/printf "This is a line of text without a newline" | 
/usr/xpg4/bin/grep -c 'line'
1
nix$

So that seems to look at a "line" that is not a "line" as we see that wc
claims there are zero lines. The manpage[1] even claims the words :

         "prints  all lines that contain that pattern"

So I have to wonder. Old Solaris 8, once fully patched, was definately
compliant with SUSv2 which is all of POSIX.1b-1993, POSIX.1c-1996 as
well as ISO/IEC 9899 (C Standard) Amendment 1.

Anyways, this is just a crusty old grey beard here putting yet another
layer of paint onto the bikeshed ( https://www.bikeshed.com/ ) and I do
apologize for the messy paintwork.

--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken


[1] the man page on ye old old Solaris 8
nix$ man grep
Reformatting page.  Please Wait... done



User Commands                                             grep(1)



NAME
      grep - search a file for a pattern

SYNOPSIS
      /usr/bin/grep [ -bchilnsvw ]  limited-regular-expression   [
      filename ... ]

      /usr/xpg4/bin/grep [ -E | -F ]   [  -c  |  -l   |  -q  ]   [
      -bhinsvwx  ]  -e pattern_list ...   [ -f pattern_file ]  ...
      [ file ... ]

      /usr/xpg4/bin/grep [ -E | -F ]   [  -c  |  -l   |  -q  ]   [
      -bhinsvwx ]  [ -e pattern_list ... ]  -f pattern_file ...  [
      file ... ]

      /usr/xpg4/bin/grep [ -E | -F ]   [  -c  |  -l   |  -q  ]   [
      -bhinsvwx ]  pattern  [ file ... ]

DESCRIPTION
      The grep utility searches  text  files  for  a  pattern  and
      prints  all lines that contain that pattern.  It uses a com-
      pact non-deterministic algorithm.

      Be careful using the characters $, *, [, ^, |, (, ),  and  \
      in  the pattern_list because they are also meaningful to the
      shell. It is safest to enclose the  entire  pattern_list  in
      single quotes  '... '.

      If no files are specified, grep assumes standard input. Nor-
      mally,  each  line  found  is copied to standard output. The
      file name is printed before each line found if there is more
      than one input file.

   /usr/bin/grep
      The /usr/bin/grep utility uses limited  regular  expressions
      like  those  described on the regexp(5) manual page to match
      the patterns.

   /usr/xpg4/bin/grep
      The options -E and  -F  affect  the  way  /usr/xpg4/bin/grep
      interprets     pattern_list.    If    -E    is    specified,
      /usr/xpg4/bin/grep interprets pattern_list as a full regular
      expression  (see  -E  for description).  If -F is specified,
      grep interprets pattern_list as a fixed string.  If  neither
      are specified, grep interprets pattern_list as a basic regu-
      lar expression as described on regex(5) manual page.

.
.
.






Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 14:40:42 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 10:40:42 2024
Received: from localhost ([127.0.0.1]:57498 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rng4Y-0000dl-5C
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 10:40:42 -0400
Received: from wfout7-smtp.messagingengine.com ([64.147.123.150]:59293)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jackson@HIDDEN>) id 1rng4V-0000dD-FI
 for 69929 <at> debbugs.gnu.org; Fri, 22 Mar 2024 10:40:40 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailfout.west.internal (Postfix) with ESMTP id 55CA71C00078;
 Fri, 22 Mar 2024 10:39:50 -0400 (EDT)
Received: from imap53 ([10.202.2.103])
 by compute2.internal (MEProxy); Fri, 22 Mar 2024 10:39:50 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:cc:content-type:content-type:date:date:from:from:in-reply-to
 :in-reply-to:message-id:mime-version:references:reply-to:subject
 :subject:to:to; s=fm2; t=1711118389; x=1711204789; bh=vjl8mYS/D1
 bU4ZHSXZvjvVBBy1/1sVLHAG2K8uUQ/zs=; b=oloZq489NqWUZfzArLYCtqqjfu
 2Gc50QcbLdkEf66dG9fihfvY5Pd6DgNk0/d/kq9EpbqtdSFH9avpTk/wle4egy8R
 tzhNcqiAmNQQcKCQnq8G9nEiQuQxN45TtM/Li3Mogv0g0f4z+l5GbNVSC4jrxAQT
 gyaQumzlvV2EediCXI5TW9pSJ7hq7M0gnE0carx1qL3YHzRQCZGlJR9gXWsTKuiZ
 3TA0mDGbzc3rHV/2Tqfw+frO+s9Thw10LFo+WF9asPort61L8KNzWiUHdSaLWGVN
 C5g1fAj3zKY16bcpj8eovr7sHjrrHD6cCyiWpw5a72RGHTk346Dp8a0/d5Zw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm2; t=1711118389; x=1711204789; bh=vjl8mYS/D1bU4ZHSXZvjvVBBy1/1
 sVLHAG2K8uUQ/zs=; b=nDhz6X0f5TXi95IHcunAE8FFlxJurRw10CyFBe1WT+kz
 +oMVPlXBj/laK6+qzPUWcdMD0MpmwUFWfKc2xhIP7CaIn5Mv14uWU4cf6sjUWNLt
 XrwslbocgV7mOOLMZkcBx8yMFgbmcRA5VnYIVY2dZJ+wXAGfp6HrbQ0BgAXs65zW
 9BJLjfmL/JU+6q7nNAhcLztBra4sUASJ76JRvfkX+7zi64CO5mNmdnOyh+7RWNxy
 XE7CwlUkr9j3JcVvWZnUMhuQMiRKbQ3HU/dNuuXlIwBSj+kCbufd9XXUs+nY2t6C
 Tvju/+q+oZCUQNghB5JlzqaPQwOzXXmAJ1Xct2XTdQ==
X-ME-Sender: <xms:NZj9ZazpV6eNIyPw8iYrJUWol4EpsBcwk7M74Fw2JIohZjo7RHRbFg>
 <xme:NZj9ZWQi5RY05X_nN7mJlPDr3iSJc6ZJafl7aRxr98XqM2p42cPTO_N4NpfiaBz1b
 O3ZYjyVDLKR>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledruddtvddgtddvucetufdoteggodetrfdotf
 fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen
 uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne
 cujfgurhepofgfggfkjghffffhvfevufgtsehttdertderredtnecuhfhrohhmpehjrggt
 khhsohhnsehfrghsthhmrghilhdrtghomhenucggtffrrghtthgvrhhnpeehveffledthf
 efgfekteehleefhfdvhfdvffduhfejtdduleeufeehieehieekveenucevlhhushhtvghr
 ufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjrggtkhhsohhnsehfrghsth
 hmrghilhdrtghomh
X-ME-Proxy: <xmx:NZj9ZcXUBQAvBqz3duNRw8x8OpYVVbiLmo-SiuF9VYPEQ9G1Es0JOw>
 <xmx:NZj9ZQgCJIDz9K7lsko3u_6Q31lpCljwrPoSO0BQkaKQYWtDkPdgWQ>
 <xmx:NZj9ZcDRy_RXc8oyE04bc9_QpN5IFLmmivXK61aUKeNRvTKfxiYPwg>
 <xmx:NZj9ZRJrIbeFDr5MK9LNtqT-BSxcUscVVd1JCRIntV2lAYvtsRn6FQ>
 <xmx:NZj9ZfNgEeozKEK11OV4fKjVZztngLmcSekxgLDBa24p9Bo-na3NTRVz_8A>
Feedback-ID: i982440cf:Fastmail
Received: by mailuser.nyi.internal (Postfix, from userid 501)
 id 0F3BF3640071; Fri, 22 Mar 2024 10:39:49 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.11.0-alpha0-332-gdeb4194079-fm-20240319.002-gdeb41940
MIME-Version: 1.0
Message-Id: <b4e4bc5b-7ad4-4646-bb9a-4134fa05cbac@HIDDEN>
In-Reply-To: <cpffrwiishz.fsf@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
 <cpffrwiishz.fsf@HIDDEN>
Date: Fri, 22 Mar 2024 09:37:55 -0500
From: jackson@HIDDEN
To: =?UTF-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>,
 "Paul Eggert" <eggert@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 69929
Cc: 69929 <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.7 (-)

Neils noted:

>> (BTW, man page says about the -q option "Exit immediately with zero
>> status if any match is found", ...

If I had the master copy of that man page in front of me right now,
I'd change that to say "... if any matching line is found ..."

>> For the time being, I hacked together a tool that does just what I need

Bingo.

Given that our talents and resources are finite, and our various
needs and situations infinite, it's impossible to have general
purpose tools that are ideal for every situation.

We can do the rest, individually.

-- 
Paul Jackson
  jackson@HIDDEN




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 08:25:12 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 04:25:12 2024
Received: from localhost ([127.0.0.1]:59745 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnaDA-0001wu-8C
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 04:25:12 -0400
Received: from mail.lysator.liu.se ([130.236.254.3]:46777)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nisse@HIDDEN>) id 1rnaD7-0001wZ-8K
 for 69929 <at> debbugs.gnu.org; Fri, 22 Mar 2024 04:25:10 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
 by mail.lysator.liu.se (Postfix) with ESMTP id 4ED04179E1;
 Fri, 22 Mar 2024 09:24:26 +0100 (CET)
Received: from shipon.lysator.liu.se (shipon.lysator.liu.se
 [IPv6:2001:6b0:17:f0a0::83])
 by mail.lysator.liu.se (Postfix) with SMTP id 239EB1797E;
 Fri, 22 Mar 2024 09:24:24 +0100 (CET)
Received: by shipon.lysator.liu.se (sSMTP sendmail emulation);
 Fri, 22 Mar 2024 09:24:24 +0100
From: =?utf-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>
To: Paul Eggert <eggert@HIDDEN>
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
In-Reply-To: <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN> (Paul Eggert's
 message of "Thu, 21 Mar 2024 17:51:34 -0700")
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
Date: Fri, 22 Mar 2024 09:24:24 +0100
Message-ID: <cpffrwiishz.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: ClamAV using ClamSMTP
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 69929
Cc: 69929 <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: -3.3 (---)

Paul Eggert <eggert@HIDDEN> writes:

> On 3/21/24 06:57, Niels M=C3=B6ller wrote:
>> I'm having grep -q read input from a pipe. I would like grep to exit
>> successfully as soon as a match occurs, without requiring the line to be
>> terminated by newline or EOF (unless the grep pattern includes '$', that
>> is).
>
> Grep used to behave almost that way. It did wait for a newline but it
> did not wait for EOF. But people started complaining about that
> behavior so we changed it.

Some --exit-early option? Sounds reasonable, but not enough for my
usecase. And I understand it might be an undesirable default behavior of
-q: Not so nice if changing "foo | grep" to "foo | grep -q" could make
foo fail with EPIPE/SIGPIPE.

(BTW, man page says about the -q option "Exit immediately with zero
status if any match is found", from reading that, I would not expect
grep to continue to read the rest of the file until EOF).

> However, not waiting for a newline is problematic; although doable it
> would be a bit of a pain to program and not sure it's worth the
> effort. Grep didn't used to do that.

I only have a rather abstract understanding of regexp matching, but for
patterns that aren't extended to require backtracking, in principle it
should be doably to feed the state machine one character at a time, with
no buffering of input?

jackson@HIDDEN writes:

> If you're not sure whether your actual input of interest will end
> in a newline, can you add one, to "feed grep's newline hunger",
> thus for instance replacing your example:
>
>   grep -q foo <(sh -c 'printf foo ; sleep 30' &)
>
> with:
>
>   grep -q foo <(sh -c 'printf foo ; echo ; sleep 30' &)

Not so easy when the input is the log output by a still running process
(in my case qemu).

> In any case, grep is quite line oriented,

Right. Maybe what I'm really looking for is a binary grep. For the time
being, I hacked together a tool that does just what I need for my qemu
test (no regexp matching, just matching a fix string starting at the
beginning of a line). See
https://git.glasklar.is/system-transparency/core/stboot/-/blob/43e91273a574=
73ee361e332926b88c1b4fe9917a/integration/look-for/look-for.go

I use this in combination with timeout (GNU coreutils) to fail the test
if no match for the login prompt is found within reasonable time.

A more general binary grep could match a regexp against a binary file or
stream, with options to exit on first match (my immediate usecase),
output the count of matches, or output the positions for each match. I
still think some of those features would make sense as part of GNU grep.

Regards,
/Niels

--=20
Niels M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 05:08:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Mar 22 01:08:34 2024
Received: from localhost ([127.0.0.1]:43924 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnX8r-0005Xe-KP
	for submit <at> debbugs.gnu.org; Fri, 22 Mar 2024 01:08:34 -0400
Received: from wfout8-smtp.messagingengine.com ([64.147.123.151]:52607)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <jackson@HIDDEN>) id 1rnV9c-0007Kf-V0
 for 69929 <at> debbugs.gnu.org; Thu, 21 Mar 2024 23:01:15 -0400
Received: from compute2.internal (compute2.nyi.internal [10.202.2.46])
 by mailfout.west.internal (Postfix) with ESMTP id 665E01C000B3;
 Thu, 21 Mar 2024 23:00:26 -0400 (EDT)
Received: from imap53 ([10.202.2.103])
 by compute2.internal (MEProxy); Thu, 21 Mar 2024 23:00:26 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com; h=
 cc:content-type:content-type:date:date:from:from:in-reply-to
 :in-reply-to:message-id:mime-version:references:reply-to:subject
 :subject:to:to; s=fm2; t=1711076425; x=1711162825; bh=qf5UmmxPf1
 bvcXFkHKC7Yi8AMitKmYcOn1O0vuFGYJY=; b=Ni1WBBBR3Bkzmpogx6T79g7Ler
 5CCQZH0F84OpFTosmF97IiHH6IbMymK36XXo9vPkMWJxihAN+Z44udpATHtPuXDz
 cVfObQTqULKAAP2O6mrI80HsUTuCkeCSc3hYWavZ3DCr3z+hsvjT5LhAaiwAd9zw
 b4zCmciQUKsr80h2C2/IfhawjTIjXh7UtmooqwE+LB359A+mCVjRWfTa5Ni4RCsT
 kFxFQIJCNYJgEeshXQeD/Mer+VeQ1laV5mY8vGrRi0GdqK+eJngWVHotF+pi19Gr
 Puu3QSAmyTHjdsUbgdknkmrub2gwbpzTUcMR+cFyacviPLgjhuL85xTok/eQ==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=
 messagingengine.com; h=cc:content-type:content-type:date:date
 :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to
 :message-id:mime-version:references:reply-to:subject:subject:to
 :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=
 fm2; t=1711076425; x=1711162825; bh=qf5UmmxPf1bvcXFkHKC7Yi8AMitK
 mYcOn1O0vuFGYJY=; b=DbY09pZwDtUGZFu/zp2EuOckPLfQx7A54qCK/5AWnSbZ
 T4j6UVph7MD0P40VEKOPZ69qJUe0Phs9Inz3RfmfghRju1aUPD06Ez8yAvG5qKsc
 lS6OuAm3b7Jhz+AluYtHrvxmisSA4zzNP+LJUezyXaLtjLTt7IgAYSym7UR9wYQo
 ZFi1wizWEHS+Qbb2IooCIoq2ypQLpfH1tVNKPrRs2zkzdtRCPTdPNYnFHbnE1kqw
 3rfeyBXDvOszOC/JLSn9D20CmWCXToqrHE43bJxEK8SPif1kqJV/okeBAsMRl4lC
 s25feQFy4GRJERom9HsffQA4ffW5SJovFxoHkTa+Ww==
X-ME-Sender: <xms:SfT8Zea5NJ207wGeb9RS7WmgFUr87RLJqtdCu0Xb64hRnZX_iybDaw>
 <xme:SfT8ZRbndWq7VOHmcTOTbZJpd-LK3uWCJk5sd6s8zTnLTxsaH4jrvWbTegamekCJE
 CS3rY0JLpyc>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrleelgddvvdcutefuodetggdotefrodftvf
 curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu
 uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc
 fjughrpefofgggkfgjfhffhffvufgtsehttdertderredtnecuhfhrohhmpehjrggtkhhs
 ohhnsehfrghsthhmrghilhdrtghomhenucggtffrrghtthgvrhhnpeeuleffledtieejke
 eikeelledtkeelleelffetieeuffdugeefffdtgfdtgfefteenucevlhhushhtvghrufhi
 iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehjrggtkhhsohhnsehfrghsthhmrg
 hilhdrtghomh
X-ME-Proxy: <xmx:SfT8ZY-AeVVCfcun2zvmVpD-pSslVIC8ctwIKvET511DjSyIU6phSA>
 <xmx:SfT8ZQqj81hHEcUJvCgNGx84mUJZFfz2wfviU2sWOfQ4Tp2Jnjp7JQ>
 <xmx:SfT8ZZors_lFOg10zr6OpZa1jA05MVfkbD06TBFJbvd7KqfTydKFbw>
 <xmx:SfT8ZeSIVIm1M24iSckb6n4Rw4m4L6FhH7gQh1RXOMY9T2csBbwtgA>
 <xmx:SfT8ZQWnh3-urDlPeK3_SPbo6gjaRUUey_NvBiKA4vGZKKhBhZb6RjQAFcQ>
Feedback-ID: i982440cf:Fastmail
Received: by mailuser.nyi.internal (Postfix, from userid 501)
 id 608F8364006F; Thu, 21 Mar 2024 23:00:25 -0400 (EDT)
X-Mailer: MessagingEngine.com Webmail Interface
User-Agent: Cyrus-JMAP/3.11.0-alpha0-332-gdeb4194079-fm-20240319.002-gdeb41940
MIME-Version: 1.0
Message-Id: <7d1c0d77-3582-4edd-b976-e8041ecc10bf@HIDDEN>
In-Reply-To: <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
References: <cpfo7b7it73.fsf@HIDDEN>
 <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
Date: Thu, 21 Mar 2024 21:58:41 -0500
From: jackson@HIDDEN
To: "Paul Eggert" <eggert@HIDDEN>,
 =?UTF-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>, 69929 <at> debbugs.gnu.org
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 69929
X-Mailman-Approved-At: Fri, 22 Mar 2024 01:08:32 -0400
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.7 (-)

Paul Eggert wrote:
> although doable it would be a bit of a pain to program

yup - sure would be a pain.

If you're not sure whether your actual input of interest will end
in a newline, can you add one, to "feed grep's newline hunger",
thus for instance replacing your example:

  grep -q foo <(sh -c 'printf foo ; sleep 30' &)

with:

  grep -q foo <(sh -c 'printf foo ; echo ; sleep 30' &)

In any case, grep is quite line oriented, as implied by an early
sentence in the man page grep(1):

"PATTERNS is one or more patterns separated by newline characters,"

-- 
  Paul Jackson
  jackson@HIDDEN




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at 69929 <at> debbugs.gnu.org:


Received: (at 69929) by debbugs.gnu.org; 22 Mar 2024 01:10:21 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 21 21:10:20 2024
Received: from localhost ([127.0.0.1]:53043 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnTQJ-00018a-95
	for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 21:10:20 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:55312)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1rnTFd-0000SH-27
 for 69929 <at> debbugs.gnu.org; Thu, 21 Mar 2024 20:59:18 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 01C563C00E405;
 Thu, 21 Mar 2024 17:51:36 -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 oSHpgIs7zEQJ; Thu, 21 Mar 2024 17:51:35 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 741543C00E406;
 Thu, 21 Mar 2024 17:51:35 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 741543C00E406
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1711068695;
 bh=70YDOWCcT5kN/k6E1uww0BaPz2xGkhNr0aHf9I1QAGw=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=E+oj90yA89f6Lc2n3yILB6cb22hKIgWthvp9ODZDmLz9fu0oOcuOuKXsQ9fI5z7SC
 V6dguUvv0hqPVYodOh2dztKdfVfTpAi8F8pGvxWy0imBWlVDUYeUBlfJ6xUXJYC+n8
 3IZdQpHTIeVxxURQlTU+jg6gdSzjI+UwNwFhtH3iwKvwd+Bu91zoOLni3KNnxQWYTG
 Iwa9Lermrt4HV2VDXFNANUekiDGERFYGJoIeCBPf58Kp3BPU4bxe70Qf/FlZrNV98z
 AynIVos3i70oxAnwHml3admW1XSJ2mQiMgLglmXhHvUNQVytMutTnGSM4Dh7Vv8R1z
 CIzCNabBokj3Q==
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 L1uv2MOYOhN6; Thu, 21 Mar 2024 17:51:35 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 598C23C00E405;
 Thu, 21 Mar 2024 17:51:35 -0700 (PDT)
Message-ID: <6b25db87-22d4-45a9-9999-3fd3284bd0af@HIDDEN>
Date: Thu, 21 Mar 2024 17:51:34 -0700
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Re: bug#69929: Can grep -q report matches in incomplete lines?
To: =?UTF-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>, 69929 <at> debbugs.gnu.org
References: <cpfo7b7it73.fsf@HIDDEN>
Content-Language: en-US
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <cpfo7b7it73.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 69929
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 3/21/24 06:57, Niels M=C3=B6ller wrote:
> I'm having grep -q read input from a pipe. I would like grep to exit
> successfully as soon as a match occurs, without requiring the line to b=
e
> terminated by newline or EOF (unless the grep pattern includes '$', tha=
t
> is).

Grep used to behave almost that way. It did wait for a newline but it=20
did not wait for EOF. But people started complaining about that behavior=20
so we changed it.

Perhaps there should be an option to switch between old and new behaviors=
.

However, not waiting for a newline is problematic; although doable it=20
would be a bit of a pain to program and not sure it's worth the effort.=20
Grep didn't used to do that.




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Mar 2024 15:03:50 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 21 11:03:50 2024
Received: from localhost ([127.0.0.1]:37072 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnJxN-0001fX-LW
	for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 11:03:49 -0400
Received: from lists.gnu.org ([209.51.188.17]:40466)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nisse@HIDDEN>) id 1rnJxK-0001fO-8l
 for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 11:03:48 -0400
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 <nisse@HIDDEN>)
 id 1rnJwb-0003mP-7u
 for bug-grep@HIDDEN; Thu, 21 Mar 2024 11:03:05 -0400
Received: from mail.lysator.liu.se ([2001:6b0:17:f0a0::3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <nisse@HIDDEN>)
 id 1rnJwW-0002E1-Qd
 for bug-grep@HIDDEN; Thu, 21 Mar 2024 11:02:59 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
 by mail.lysator.liu.se (Postfix) with ESMTP id 856BA14764
 for <bug-grep@HIDDEN>; Thu, 21 Mar 2024 16:02:50 +0100 (CET)
Received: from shipon.lysator.liu.se (shipon.lysator.liu.se
 [IPv6:2001:6b0:17:f0a0::83])
 by mail.lysator.liu.se (Postfix) with SMTP id 7927914670
 for <bug-grep@HIDDEN>; Thu, 21 Mar 2024 16:02:49 +0100 (CET)
Received: by shipon.lysator.liu.se (sSMTP sendmail emulation);
 Thu, 21 Mar 2024 16:02:49 +0100
From: =?utf-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>
To: bug-grep@HIDDEN
Subject: Re: Can grep -q report matches in incomplete lines?
In-Reply-To: <cpfo7b7it73.fsf@HIDDEN> ("Niels =?utf-8?Q?M?=
 =?utf-8?Q?=C3=B6ller=22's?= message
 of "Thu, 21 Mar 2024 14:57:04 +0100")
References: <cpfo7b7it73.fsf@HIDDEN>
Date: Thu, 21 Mar 2024 16:02:49 +0100
Message-ID: <cpfjzlviq5i.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: ClamAV using ClamSMTP
Received-SPF: pass client-ip=2001:6b0:17:f0a0::3;
 envelope-from=nisse@HIDDEN; helo=mail.lysator.liu.se
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.7 (-)
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: -2.7 (--)

Niels M=C3=B6ller <nisse@HIDDEN> writes:

> E.g., if I run=20
>
>   (printf foo ; sleep 30) | grep -q foo
>
> I want grep to exit successfully right away. Currently, grep waits until
> it gets EOF on the input, 30 seconds later.

Sorry if I'm confused about how to script this. The following (bash
syntax) is a better example:

  grep -q foo <(sh -c 'printf foo ; sleep 30' &)

This blocks 30 seconds before exiting. In contrast,=20

  grep -q foo <(sh -c echo foo ; sleep 30' &)

(only difference is the newline at the end of the line) does exit
immediately.

Regards,
/Niels

--=20
Niels M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.




Information forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 21 Mar 2024 13:57:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 21 09:57:57 2024
Received: from localhost ([127.0.0.1]:36994 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnIvb-0005AU-TH
	for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 09:57:57 -0400
Received: from lists.gnu.org ([209.51.188.17]:49020)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <nisse@HIDDEN>) id 1rnIvZ-0005AJ-5i
 for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 09:57:54 -0400
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 <nisse@HIDDEN>)
 id 1rnIuu-0002sb-Ts
 for bug-grep@HIDDEN; Thu, 21 Mar 2024 09:57:12 -0400
Received: from mail.lysator.liu.se ([130.236.254.3])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <nisse@HIDDEN>)
 id 1rnIus-0004pY-E9
 for bug-grep@HIDDEN; Thu, 21 Mar 2024 09:57:12 -0400
Received: from mail.lysator.liu.se (localhost [127.0.0.1])
 by mail.lysator.liu.se (Postfix) with ESMTP id 161DF14355
 for <bug-grep@HIDDEN>; Thu, 21 Mar 2024 14:57:06 +0100 (CET)
Received: from shipon.lysator.liu.se (shipon.lysator.liu.se
 [IPv6:2001:6b0:17:f0a0::83])
 by mail.lysator.liu.se (Postfix) with SMTP id 0863C14269
 for <bug-grep@HIDDEN>; Thu, 21 Mar 2024 14:57:04 +0100 (CET)
Received: by shipon.lysator.liu.se (sSMTP sendmail emulation);
 Thu, 21 Mar 2024 14:57:04 +0100
From: =?utf-8?Q?Niels_M=C3=B6ller?= <nisse@HIDDEN>
To: bug-grep@HIDDEN
Subject: Can grep -q report matches in incomplete lines?
Date: Thu, 21 Mar 2024 14:57:04 +0100
Message-ID: <cpfo7b7it73.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: ClamAV using ClamSMTP
Received-SPF: pass client-ip=130.236.254.3; envelope-from=nisse@HIDDEN;
 helo=mail.lysator.liu.se
X-Spam_score_int: -41
X-Spam_score: -4.2
X-Spam_bar: ----
X-Spam_report: (-4.2 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3,
 SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.7 (-)
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: -2.7 (--)

Hi,

I'm having grep -q read input from a pipe. I would like grep to exit
successfully as soon as a match occurs, without requiring the line to be
terminated by newline or EOF (unless the grep pattern includes '$', that
is).

E.g., if I run=20

  (printf foo ; sleep 30) | grep -q foo

I want grep to exit successfully right away. Currently, grep waits until
it gets EOF on the input, 30 seconds later. I'm testing with GNU grep
3.8, running on Debian GNU/Linux.

Another less friendly example:

  (printf foo ; cat /dev/zero | tr '\0' x) | grep -q foo

It would be nice if that exited quickly. And without any excessive
memory usage, with or without match.

My actual usecase is for a test booting a machine in qemu. I pipe qemu's
output (including the console of the guest machine) to grep, and I want
to check that the machine gets to the login prompt. But there's usually
no trailing newline after that prompt.

Regards,
/Niels


--=20
Niels M=C3=B6ller. PGP key CB4962D070D77D7FCB8BA36271D8F1FF368C6677.
Internet email is subject to wholesale government surveillance.





Acknowledgement sent to Niels Möller <nisse@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-grep@HIDDEN. Full text available.
Report forwarded to bug-grep@HIDDEN:
bug#69929; Package grep. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Mar 2024 16:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.