X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; q=dns; s=default; b=G0NgKCKIkkNuHomb
	RTrsJESWaMtAxFznFstfYRjAGODI/n2fSOIh8azaxoj89SUXAB05wUcJZv9Ey7EO
	kL0sTfJ8XW086JFLEyyCFWNCa9MywNzyQc2oP/alQmLEL/QD7jLzeaohn7Zr3Kq1
	XOV6GYO92uHKJ5P9oMoEzoHmcB4=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:subject:to:references:from:message-id:date
	:mime-version:in-reply-to:content-type
	:content-transfer-encoding; s=default; bh=2WuJNKiI9CCBUD7gCM6zsQ
	KcgRM=; b=Q7JGiLiqUoLikjm0L9j+dtJFItKCndr81MuemoK6cwM6AAW6o57aG2
	8w6V1CKDf2MdKDH3T8c1R984L7zUycmyFCBf/+aumkFKZEsc4/QE9Psc//X46mJ+
	ZjeKzAGX+mp8mjrFB3Z0MsnsJOczpnw3WFFaELQ+IZlJBpRUdl5ik=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=executive
X-HELO: mx1.redhat.com
Subject: Re: grep < fifo fails
To: cygwin@cygwin.com
References: <d56a12c77ecc441ca7dc2e8e1862145c@prosa.dk> <d8e9dbf61b6299cae6db6da3a25eabb8@smtp-cloud9.xs4all.net> <bb7dfc32e67366d58d10eb4dc2eda7f5@smtp-cloud7.xs4all.net> <8100972155fcccd61852c0c9e48cd11b@smtp-cloud9.xs4all.net> <4749b23a0374bf264ad46a0c7466e73e@smtp-cloud9.xs4all.net>
From: Eric Blake <eblake@redhat.com>
Message-ID: <81eb7a95-1334-a421-46e3-64c51800947c@redhat.com>
Date: Mon, 8 Oct 2018 10:03:03 -0500
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0
MIME-Version: 1.0
In-Reply-To: <4749b23a0374bf264ad46a0c7466e73e@smtp-cloud9.xs4all.net>
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

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!

-- 
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

