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=x+RBaG hE4wA0mQgcdnIqEB8oLkVK409F8RZY3U4L+CmpN1COl+m+dI6vUxA86eCYd2Y8IO HrKrP2K+U5ij3nr5MikrAsCTd0KDLXVS2x/2By722cIqRjPeu4EXcA79n+y5W/sx hPILIa0SWdj3q4tf6wK149aIZfzAC4XkRSv9Y= 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=yVMFex3i+Mak d2sv5cqmjs1dpqA=; b=cz0q/AWJlSEQKcZGRMD3eW9Z5sz95ghpHAJKr/+DEj9t +zJSz+JpIK2NidtuIRCI2d9E6O1uiBPoZagXB9VF8lT0KXATGOd10QBYXXZz/w2w D90M4atvtt2fY+cbY4hKGMauvZjDy0rEjBm5LZg7xWSfpJVEzdqSEhRVRTlfTe8= 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=-0.7 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=cygwin's, ole, cygwins, filed X-HELO: lb3-smtp-cloud9.xs4all.net Date: Mon, 08 Oct 2018 10:24:01 +0200 Message-ID: <4749b23a0374bf264ad46a0c7466e73e@smtp-cloud9.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> In-Reply-to: <8100972155fcccd61852c0c9e48cd11b@smtp-cloud9.xs4all.net> Content-Type: text/plain; charset=UTF-8; format=fixed User-Agent: mua.awk 0.99 On Fri, 05 Oct 2018 17:32:16, Houder wrote: > On Thu, 04 Oct 2018 18:02:03, Houder wrote: > > On Wed, 03 Oct 2018 20:46:11, 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 > > > > > > > > I see the same behavior on MINGW, but I do not see the same behavior on GNU= > > > > /Linux. > > > > My apologies. Did not read your post as careful as I should have the first time. > > You are correct: grep is in error here. > > Filed this bug at bug-grep AT gnu DOT org; it is filed under number 32943. > > - https://debbugs.gnu.org/cgi/bugreport.cgi?bug=32943 > 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() ). 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