mailing list of musl libc
 help / color / mirror / code / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: "Buchholz, Robert" <robert.buchholz@here.com>
Cc: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: Re: [musl] Bug: ftell() after fopen(..., "ab") returns 0 unless an explicit fseek() is used first
Date: Thu, 11 Aug 2022 13:36:33 +0200	[thread overview]
Message-ID: <87tu6jt3jy.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <HE1PR04MB30817A979774EB8803BE4B0490649@HE1PR04MB3081.eurprd04.prod.outlook.com> (Robert Buchholz's message of "Thu, 11 Aug 2022 11:14:09 +0000")

* Robert Buchholz:

> On my Alpine/MUSL setup this prints "0 6" while on Ubuntu 22.04 with
> glibc it prints "3 6" - which I'm assuming is the expected output.

Both behaviors are acceptable.  C11 (7.21.3p1) says this:

| If a file can support positioning requests (such as a disk file, as
| opposed to a terminal), then a file position indicator associated with
| the stream is positioned at the start (character number zero) of the
| file, unless the file is opened with append mode in which case it is
| implementation-defined whether the file position indicator is initially
| positioned at the beginning or the end of the file.

musl is likely not the only libc with this type of behavior, given that
it's explicitly allowed by the standard.

Thanks,
Florian


  reply	other threads:[~2022-08-11 11:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-11 11:14 Buchholz, Robert
2022-08-11 11:36 ` Florian Weimer [this message]
2022-08-18  0:31   ` Rich Felker

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=87tu6jt3jy.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=musl@lists.openwall.com \
    --cc=robert.buchholz@here.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).