Web lists-archives.com

Re: grep < fifo fails

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


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!

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple