X-Recipient: archive-cygwin AT delorie DOT 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:date:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; q=dns; s=default; b=mDf5/B Drs6AFcZisT3mXzTswsOqenp3yLGAyqbA9+TYZlWSyfPry73nwTkAZDuocHtFDe8 ypvvNwdaTV5f7gQ2+NCQbJR4yV1itUbxM+pRiFggLlW7XwBUuMEgHiyIPdAyVyqk X7mRRu/Htz41kuhMsIofJZJjGBIa547TjtJZ0= 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:date:message-id:from:reply-to:to:subject :references:in-reply-to:content-type; s=default; bh=zEn5WEOVtw9p uFdhQTy0maHmfSY=; b=ubGN3NwjFQPVNNWciyycffFIlIvIPhiI2cjchYwG0jiJ hHEwn2BIYKRHSatp39YR3P85PEez4KJZLHkK71bdKbGsl/zJK9Xfw3ZHgZ9aLHgZ A01O10BMzkGduvHD/yhlhozLQKm+NBM0wrium0A2JnD4FbhO+2mWXMhqinyF2K0= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,NORMAL_HTTP_TO_IP,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*F:D*nl, D*@, executive X-HELO: lb1-smtp-cloud7.xs4all.net Date: Wed, 10 Oct 2018 11:53:00 +0200 Message-ID: <6e92e94397270abb3a0fb6f2e2ae569b@smtp-cloud7.xs4all.net> From: Houder Reply-To: cygwin AT cygwin DOT com To: cygwin AT cygwin DOT com Subject: Re: grep < fifo fails References: <8100972155fcccd61852c0c9e48cd11b AT smtp-cloud9 DOT xs4all DOT net> <4749b23a0374bf264ad46a0c7466e73e AT smtp-cloud9 DOT xs4all DOT net> In-Reply-to: <4749b23a0374bf264ad46a0c7466e73e@smtp-cloud9.xs4all.net> Content-Type: text/plain; charset=UTF-8; format=fixed User-Agent: mua.awk 0.99 On Mon, 08 Oct 2018 10:24:01, Houder wrote: ... > > > > On Wed, 3 Oct 2018 15:37:14, Ole Tange wrote: > > > > > This works: > > > > > > > > > > $ mkfifo fifo > > > > > $ echo > fifo & grep . fifo > > > > > [1] 10232 > > > > > [1]+ Done echo > fifo > > > > > > > > > > But this fails: > > > > > > > > > > $ echo > fifo & grep . < fifo > > > > > [1] 11756 > > > > > grep: (standard input): Invalid argument > > > > > [1]+ Done echo > fifo ... > 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. [snip] > The solution would be either to correct Cygwin's executive or to > insert a Cygwin-specific kludge in grep (in reset() ). Right. 64-@@ echo aaa > fifo & grep . < fifo [1] 3956 aaa [2]+ Done echo aaa > fifo The following rough patch to the Cygwin executive ... uhm, Cygwin DLL, makes the above work. winsup/cygwin/fhandler.h: class fhandler_fifo: public fhandler_base_overlapped { ... // Henri off_t lseek (off_t, int) { set_errno (ESPIPE); return -1; } ... }; (I cheated; I did a copy/paste of what is already present in fhandler.h) Regards, Henri -- 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