mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Rich Felker <dalias@aerifal.cx>
To: musl@lists.openwall.com
Subject: Re: musl bugs
Date: Wed, 28 Sep 2011 11:40:24 -0400	[thread overview]
Message-ID: <20110928154024.GQ132@brightrain.aerifal.cx> (raw)
In-Reply-To: <20110928075446.GA3840@albatros>

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


      reply	other threads:[~2011-09-28 15:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 16:06 Vasiliy Kulikov
2011-09-27 21:00 ` Rich Felker
2011-09-28  7:54   ` Vasiliy Kulikov
2011-09-28 15:40     ` Rich Felker [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110928154024.GQ132@brightrain.aerifal.cx \
    --to=dalias@aerifal.cx \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).