GNU bug report logs - #21621
Bug | grep | Running in loop

Previous Next

Package: grep;

Reported by: Gino Atlas <ga <at> gino-atlas.de>

Date: Mon, 5 Oct 2015 15:22:02 UTC

Severity: normal

Tags: notabug

Done: Eric Blake <eblake <at> redhat.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 21621 in the body.
You can then email your comments to 21621 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-grep <at> gnu.org:
bug#21621; Package grep. (Mon, 05 Oct 2015 15:22:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Gino Atlas <ga <at> gino-atlas.de>:
New bug report received and forwarded. Copy sent to bug-grep <at> gnu.org. (Mon, 05 Oct 2015 15:22:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Gino Atlas <ga <at> gino-atlas.de>
To: bug-grep <at> gnu.org
Subject: Bug | grep | Running in loop
Date: Mon, 05 Oct 2015 15:29:56 +0200
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 
directory.)

It seems like it’s 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?

Best Regards
Gino Atlas




Added tag(s) notabug. Request was from Eric Blake <eblake <at> redhat.com> to control <at> debbugs.gnu.org. (Mon, 05 Oct 2015 20:41:02 GMT) Full text and rfc822 format available.

Reply sent to Eric Blake <eblake <at> redhat.com>:
You have taken responsibility. (Mon, 05 Oct 2015 20:41:03 GMT) Full text and rfc822 format available.

Notification sent to Gino Atlas <ga <at> gino-atlas.de>:
bug acknowledged by developer. (Mon, 05 Oct 2015 20:41:03 GMT) Full text and rfc822 format available.

Message #12 received at 21621-done <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Gino Atlas <ga <at> gino-atlas.de>, 21621-done <at> debbugs.gnu.org
Subject: Re: bug#21621: Bug | grep | Running in loop
Date: Mon, 5 Oct 2015 14:39:56 -0600
[Message part 1 (text/plain, inline)]
tag 21621 notabug
thanks

On 10/05/2015 07:29 AM, Gino Atlas wrote:
> 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 directory.)
> 
> It seems like it’s 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?
> 

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.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 03 Nov 2015 12:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 9 years and 286 days ago.

Previous Next


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