From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/7884 Path: news.gmane.org!not-for-mail From: Laurent Bercot Newsgroups: gmane.linux.lib.musl.general Subject: Re: Making stdio writes robust/recoverable under errors Date: Fri, 05 Jun 2015 23:47:33 +0200 Message-ID: <557218F5.20306@skarnet.org> References: <20150529135300.GD17573@brightrain.aerifal.cx> <20150605211401.GW17573@brightrain.aerifal.cx> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1433540863 26731 80.91.229.3 (5 Jun 2015 21:47:43 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 5 Jun 2015 21:47:43 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-7897-gllmg-musl=m.gmane.org@lists.openwall.com Fri Jun 05 23:47:39 2015 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1Z0zSf-0008Ob-U3 for gllmg-musl@m.gmane.org; Fri, 05 Jun 2015 23:47:34 +0200 Original-Received: (qmail 19772 invoked by uid 550); 5 Jun 2015 21:47:32 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Original-Received: (qmail 19754 invoked from network); 5 Jun 2015 21:47:32 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 In-Reply-To: <20150605211401.GW17573@brightrain.aerifal.cx> Xref: news.gmane.org gmane.linux.lib.musl.general:7884 Archived-At: On 05/06/2015 23:14, Rich Felker wrote: > I'm a bit undecided on whether to move forward with this or not. While > there's some benefit to being able to resume/recover transient errors > that occur during buffered writing, there are also disadvantages My unpopular but firm opinion, which I already have expressed here, is that stdio is a toy interface that should not be used for any output that requires the simplest hint of reliability. The loss of information about the number of bytes actually written when an error occurs is a major pain point; even if the underlying implementation is as good as can be, the API is just too poor and it's either fight the interface (in which case you have already lost), use non-portable extensions (which musl aims to avoid), or put stdio back into the trash bin and use something else entirely. People who use stdio and expect good behaviour when an error occurs deserve what's coming at them, and I think that worse is better in this case: fail as badly as is permitted by the standard instead of trying to salvage as many scraps as you can. Even if you manage to save a few close calls, the next crash and burn is just around the corner. So, I vote for not devoting any more brain power to "stdio robustness" than is strictly necessary to be standards-compliant. -- Laurent