From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 05 11:21:40 2015 Received: (at submit) by debbugs.gnu.org; 5 Oct 2015 15:21:40 +0000 Received: from localhost ([127.0.0.1]:55354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zj7a8-0001YP-4b for submit@debbugs.gnu.org; Mon, 05 Oct 2015 11:21:40 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37195) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Zj5qH-0007KC-I1 for submit@debbugs.gnu.org; Mon, 05 Oct 2015 09:30:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zj5qB-0005yV-OF for submit@debbugs.gnu.org; Mon, 05 Oct 2015 09:30:13 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled version=3.3.2 Received: from lists.gnu.org ([2001:4830:134:3::11]:46907) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj5qB-0005yI-ME for submit@debbugs.gnu.org; Mon, 05 Oct 2015 09:30:07 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47171) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj5qA-0002DI-VV for bug-grep@gnu.org; Mon, 05 Oct 2015 09:30:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zj5q3-0005g8-FM for bug-grep@gnu.org; Mon, 05 Oct 2015 09:30:02 -0400 Received: from cepheus.uberspace.de ([95.143.172.188]:42981) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zj5q3-0005eO-9e for bug-grep@gnu.org; Mon, 05 Oct 2015 09:29:59 -0400 Received: (qmail 19422 invoked from network); 5 Oct 2015 13:29:57 -0000 Received: from localhost (HELO webmail.cepheus.uberspace.de) (127.0.0.1) by localhost with SMTP; 5 Oct 2015 13:29:57 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: quoted-printable Date: Mon, 05 Oct 2015 15:29:56 +0200 From: Gino Atlas To: bug-grep@gnu.org Subject: Bug | grep | Running in loop Message-ID: X-Sender: ga@gino-atlas.de X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 05 Oct 2015 11:21:38 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) Dear ladies and gentlemen, I would like to report a bug. When I run this command: grep -rl '^PATTERN$'. ^C (Pay attention to the non-whitespace between pattern and target=20 directory.) It seems like it=E2=80=99s running in a loop, though, I was expecting a tim= eout=20 would occur after a while. Can you confirm it's a bug and the behaviour is expected? Best Regards Gino Atlas From debbugs-submit-bounces@debbugs.gnu.org Mon Oct 05 16:40:08 2015 Received: (at control) by debbugs.gnu.org; 5 Oct 2015 20:40:08 +0000 Received: from localhost ([127.0.0.1]:55494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZjCYJ-0000Qo-KZ for submit@debbugs.gnu.org; Mon, 05 Oct 2015 16:40:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46339) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZjCYF-0000QY-7p; Mon, 05 Oct 2015 16:40:04 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 628D4C0A147E; Mon, 5 Oct 2015 20:40:01 +0000 (UTC) Received: from [10.3.113.202] (ovpn-113-202.phx2.redhat.com [10.3.113.202]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t95Ke1Cv023108; Mon, 5 Oct 2015 16:40:01 -0400 Subject: Re: bug#21621: Bug | grep | Running in loop To: Gino Atlas , 21621-done@debbugs.gnu.org References: From: Eric Blake Openpgp: url=http://people.redhat.com/eblake/eblake.gpg X-Enigmail-Draft-Status: N1110 Organization: Red Hat, Inc. Message-ID: <5612E01C.8090006@redhat.com> Date: Mon, 5 Oct 2015 14:39:56 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uNfirUShjkcw0x1OOwVBuRM4Ign6bHMNC" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --uNfirUShjkcw0x1OOwVBuRM4Ign6bHMNC Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable tag 21621 notabug thanks On 10/05/2015 07:29 AM, Gino Atlas wrote: > Dear ladies and gentlemen, >=20 > I would like to report a bug. > When I run this command: > grep -rl '^PATTERN$'. > ^C > (Pay attention to the non-whitespace between pattern and target directo= ry.) >=20 > It seems like it=E2=80=99s running in a loop, though, I was expecting a= timeout > would occur after a while. > Can you confirm it's a bug and the behaviour is expected? >=20 Yes, that is the expected behavior. You didn't tell grep what file to read, so it is defaulting to reading stdin. But stdin is your terminal, and grep is waiting for you to type. When you are done with your input, type Ctrl-D to tell the terminal to send an EOF to grep, so that it can quit reading stdin. Perhaps it could be argued that grep should recognize when its stdin is a terminal, and issue a warning to the user that they may have forgotten to specify an input location and to press ctrl-D to break out of grep waiting for the user to type something. But GNU Coding Standards discourage a program behaving differently merely because stdin is a terminal. At any rate, since the behavior is intentional, and since grep is waiting for you to do something (it is NOT burning 100% CPU during that wait), I'm marking this as not a bug. However, feel free to add more comments or questions on the topic. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --uNfirUShjkcw0x1OOwVBuRM4Ign6bHMNC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWEuAcAAoJEKeha0olJ0NqLm4IAIkoZidTPGyxTPAkmouAKj4K gwTWH5aKZKciM1MSYgGnzt96ZB/Vgs0IUVcBD0rEji6yhb4q90md5uSCvtDiGRzT /Is6xQ8GyoABcuyNTFal1XfPFcNWn5Kz4kNKDIS9TK3UnHiZpCDIjgvEWJjy+b6L 5AFTYrzydUfnZ8TfDCYyb1FOUmKr3jI7tsV+yVlqW6axT2dWQH5eon9F1PDBZzg9 P8r8omcpLGy36pKVCmpq2Lz3nR71MA5hCx6Qwm1RHnqxZYENzGSFRlnT9Z1+2l82 TV4tUSe3alGkcWIdZRDHIEvmzXXIplKD0jI0mOxcAeFl0Y7SazeVpVPXegJrvwg= =hcCj -----END PGP SIGNATURE----- --uNfirUShjkcw0x1OOwVBuRM4Ign6bHMNC-- From unknown Sat Aug 16 19:17:03 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 03 Nov 2015 12:24:03 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator