From owner-freebsd-bugs@FreeBSD.ORG Fri Feb 10 20:50:12 2012 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C8F9A1065670 for ; Fri, 10 Feb 2012 20:50:12 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:4f8:fff6::28]) by mx1.freebsd.org (Postfix) with ESMTP id B3BD68FC1E for ; Fri, 10 Feb 2012 20:50:12 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id q1AKoCeJ064491 for ; Fri, 10 Feb 2012 20:50:12 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id q1AKoCe6064490; Fri, 10 Feb 2012 20:50:12 GMT (envelope-from gnats) Date: Fri, 10 Feb 2012 20:50:12 GMT Message-Id: <201202102050.q1AKoCe6064490@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Diomidis Spinellis Cc: Subject: Re: bin/164947: tee looses data when writing to non-blocking file descriptors X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Diomidis Spinellis List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 10 Feb 2012 20:50:12 -0000 The following reply was made to PR bin/164947; it has been noted by GNATS. From: Diomidis Spinellis To: Martin Cracauer Cc: freebsd-gnats-submit@freebsd.org Subject: Re: bin/164947: tee looses data when writing to non-blocking file descriptors Date: Fri, 10 Feb 2012 22:32:02 +0200 On 10/02/2012 21:17, Martin Cracauer wrote: > Diomidis Spinellis wrote on Fri, Feb 10, 2012 at 07:04:41AM +0000: >> >>> Number: 164947 [...] >>> How-To-Repeat: >> Run the following: >> #!/usr/local/bin/bash >> # bash needed for the>(...) functionality >> # ssh apparently sets O_NONBLOCK >> # Remove the 2>/dev/null to see tee complaining >> dd count=100000 if=/dev/zero | >> tee>(ssh localhost dd of=/dev/null) 2>/dev/null | >> (ssh localhost dd of=/dev/null) > > I don't think it is ssh that is causing this. If you use a named pipe > explicitly and hook ssh up to that the error doesn't appear. Seems to > be something that bash is doing there. I think the named pipe isolates the write fd from the ssh end. If you use cat or dd instead of ssh the problem goes away. > That doesn't mean I am opposed to handling EAGAIN. > > The way I normally do it is a simple retry loop, not using select. > I'm aware of the tradeoffs, so far I was always better off not > investing a second system call into every retry. I agree this can be cheaper for many cases, but it can become very expensive for long waits.