From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/488 Path: news.gmane.org!not-for-mail From: Rich Felker Newsgroups: gmane.linux.lib.musl.general Subject: Re: musl bugs Date: Wed, 28 Sep 2011 11:40:24 -0400 Message-ID: <20110928154024.GQ132@brightrain.aerifal.cx> References: <20110927160646.GA23877@albatros> <20110927210004.GO132@brightrain.aerifal.cx> <20110928075446.GA3840@albatros> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1317224812 29003 80.91.229.12 (28 Sep 2011 15:46:52 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 28 Sep 2011 15:46:52 +0000 (UTC) To: musl@lists.openwall.com Original-X-From: musl-return-489-gllmg-musl=m.gmane.org@lists.openwall.com Wed Sep 28 17:46:48 2011 Return-path: Envelope-to: gllmg-musl@lo.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by lo.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1R8wLQ-0007Hh-IV for gllmg-musl@lo.gmane.org; Wed, 28 Sep 2011 17:46:48 +0200 Original-Received: (qmail 23703 invoked by uid 550); 28 Sep 2011 15:46:48 -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 23694 invoked from network); 28 Sep 2011 15:46:47 -0000 Content-Disposition: inline In-Reply-To: <20110928075446.GA3840@albatros> User-Agent: Mutt/1.5.21 (2010-09-15) Xref: news.gmane.org gmane.linux.lib.musl.general:488 Archived-At: On Wed, Sep 28, 2011 at 11:54:46AM +0400, Vasiliy Kulikov wrote: > On Tue, Sep 27, 2011 at 17:00 -0400, Rich Felker wrote: > > On Tue, Sep 27, 2011 at 08:06:46PM +0400, Vasiliy Kulikov wrote: > > > Hi Rich, > > > > > > getmntent_r(): > > > - fgets() should be checked for too small buffer. > > > > And what should happen? ERANGE? This non-standardized stuff is so > > poorly documented... Should it seek back and allow you to read the > > entry next time with a larger buffer? Or should it just fail? > > The right thing would be seeking back, but at least glibc simply ignores > the error and seeks to the end of line. I don't known whether seek back > is better given this behaviour is not documented... To be consistent > with glibc IMHO it should seek till the EOL, but return the error. If implementations differ, a correct program will always need to save the location and seek back to work reliably. On the other hand, if the implementation seeks back, it will break applications that want to just ignore overly-long lines and keep reading (they'll hit an infinite loop of failures). Also, seeking back the way I do it now causes breakage even if the long line is just a comment. Thus I'm leaning towards going with the glibc behavior. Rich