bug-grep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bug#669084: grep does not match anything when reading from stdin


From: Aníbal Monsalve Salazar
Subject: Re: Bug#669084: grep does not match anything when reading from stdin
Date: Tue, 17 Apr 2012 20:13:49 +1000
User-agent: Mutt/1.5.20 (2009-06-14)

On Tue, Apr 17, 2012 at 11:08:16AM +0200, Tino Keitel wrote:
>On Tue, Apr 17, 2012 at 10:25:03 +0200, Tino Keitel wrote:
>>On Tue, Apr 17, 2012 at 10:23:28 +0200, Tino Keitel wrote:
>>>On Tue, Apr 17, 2012 at 18:07:29 +1000, Aníbal Monsalve Salazar wrote:
>>>>On Tue, Apr 17, 2012 at 09:23:58AM +0200, Tino Keitel wrote:
>>>>>Package: grep
>>>>>Version: 2.11-2
>>>>>Severity: important
>>>>>
>>>>>grep does not match anything when reading from stdin. Reading from
>>>>>a file works.
>>>>>
>>>>>$ echo foo > foo
>>>>>$ grep . foo
>>>>>foo
>>>>>$ cat foo | grep .
>>>>>$ echo foo | grep .
>>>>>$ 
>>>>
>>>>It works for me, please see below.
>>
>>The version from testing (2.10-1) works here, too.
>
>This snipset from the 2.11 main.c is very likely the culprit. The
>'S_ISFIFO (stats->stat.st_mode)' causes stdin to be skipped if it is a
>pipe.
>
>if ((directories == SKIP_DIRECTORIES && S_ISDIR (stats->stat.st_mode))
>    || (devices == SKIP_DEVICES && (S_ISCHR (stats->stat.st_mode)
>                                    || S_ISBLK (stats->stat.st_mode)
>                                    || S_ISSOCK (stats->stat.st_mode)
>                                    || S_ISFIFO (stats->stat.st_mode))))
>  {
>    if (file)
>      close (desc);
>    return 1;
>  }

Hello Jim,

grep-2.11 introduced a regression related to the "-D skip" parameter
option.

With grep-2.10 (or less than 2.10):

$ echo foo | grep -D skip foo; echo $?
foo
0

With grep-2.11:

$ echo foo | grep -D skip foo; echo $?
1

Timo suggests that the possible culprit is the code above.

The Debian bug report is at http://bugs.debian.org/668585

Cheers,

Anibal



reply via email to

[Prev in Thread] Current Thread [Next in Thread]