grep < fifo fails

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Oct 10 11:22:00 GMT 2018


On Oct  8 10:03, Eric Blake wrote:
> On 10/8/18 3:24 AM, Houder wrote:
> > grep fails on Cygwin because lseek() on Cygwin fails to recognize
> > that it is applied to a FIFO. As result of that, it returns EINVAL
> > in errno, where it should return ESPIPE.
> > 
> > Receiving the wrong value in errno forces reset() (in src/grep.c)
> > to return false, upon which grep fails.
> > 
> > Before v2.27 of grep, a call to S_ISREG(st->st_mode) in reset()
> > prevented the call of lseek() and made reset() return true.
> > 
> > The call to S_ISREG() has been removed in v2.27 of grep.
> > 
> > The solution would be either to correct Cygwin's executive or to
> 
> s/executive/dll/
> 
> > insert a Cygwin-specific kludge in grep (in reset() ).
> 
> I see no reason to do a one-off kludge to my build of grep (since that does
> not scale - every other app that also makes decisions based on errno values
> would have to make the same kludge), compared to just fixing cygwin1.dll for
> everyone.
> 
> But thanks for isolating the problem!

I pushed a patch.  Thanks for tracking this down, Henri!


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20181010/d47cb4d7/attachment.sig>


More information about the Cygwin mailing list