Date: Sat, 11 Feb 2012 07:30:13 GMT From: Diomidis Spinellis <dds@aueb.gr> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/164947: tee looses data when writing to non-blocking file descriptors Message-ID: <201202110730.q1B7UDp2074053@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/164947; it has been noted by GNATS. From: Diomidis Spinellis <dds@aueb.gr> To: davidxu@FreeBSD.org Cc: David Xu <listlog2011@gmail.com>, freebsd-gnats-submit@FreeBSD.org Subject: Re: bin/164947: tee looses data when writing to non-blocking file descriptors Date: Sat, 11 Feb 2012 09:25:34 +0200 On 11/02/2012 05:21, David Xu wrote: > On 2012/2/10 15:04, Diomidis Spinellis wrote: >>> Number: 164947 >>> Category: bin >>> Synopsis: tee looses data when writing to non-blocking file descriptors >>> Confidential: no >>> Severity: serious >>> Priority: medium >>> Responsible: freebsd-bugs >>> State: open >>> Quarter: >>> Keywords: >>> Date-Required: >>> Class: sw-bug >>> Submitter-Id: current-users >>> Arrival-Date: Fri Feb 10 07:10:09 UTC 2012 >>> Closed-Date: >>> Last-Modified: >>> Originator: Diomidis Spinellis >>> Release: 8.1 >>> Organization: >> AUEB >>> Environment: >> FreeBSD istlab.dmst.aueb.gr 8.1-RELEASE-p6 FreeBSD 8.1-RELEASE-p6 #0: >> Tue Nov 1 15:16:34 EET 2011 >> dds@istlab.dmst.aueb.gr:/usr/obj/usr/src/sys/ISTLAB i386 >> You have new mail in /var/mail/dds >> >>> Description: >> When tee(1) tries to write to a file descriptor that has been set to >> non-blocking mode the write(2) call may fail with EAGAIN. Instead of >> retrying the operation, tee will throw that chunk of data away. > so tee should also work with non-blocking read, your patch is incomplete. You're right. By the same argument all other utilities should also be fixed. However, this may create new bugs and instability. For the specific case of tee writing I offered a test case, demonstrating the problem. This was distilled from an actual production use (scattering a dump to tape and disk). I think it's best to fix each utility as the need arises.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201202110730.q1B7UDp2074053>