mailing list of musl libc
 help / color / mirror / code / Atom feed
From: "Laurent Bercot" <ska-dietlibc@skarnet.org>
To: musl@lists.openwall.com
Subject: Re[2]: [musl] Prototypes without implementations
Date: Sat, 26 Oct 2024 10:28:38 +0000	[thread overview]
Message-ID: <emc3229b12-3f5c-4847-9cc7-49c0f43ca089@b9cddb74.com> (raw)
In-Reply-To: <ZxynqAh9f332yOSu@voyager>

>I don't understand the remainder of the thread as it is now, because
>normally we consider the above behavior to be insanity.

  Who's "we"?


>  Just because a
>function exists in the lib does not mean it will succeed at run-time.
>This is already the case with functions like getrandom() or pselect().

  getrandom() is part of the problem, yes - a function that you cannot
test for at link time and that you have to make depend on a kernel
version in order to use. But because the problem already exists doesn't
mean it's a good idea to add to it.

  pselect() is posix, it has a specification. If your pselect() isn't
doing what it's supposed to, then your implementation is nonconformant.
Yes, nonconformant systems are ubiquitous too, that's a problem too,
and that's why we test stuff, but standards are still a good thing.
strlen() works everywhere and you don't need to test for it. (Yes,
it's a low bar. And it's not true for strnlen(). Don't get me started.)


>Even if you could run run-time tests, just because it succeeds at
>configure time does not mean it succeeds at any later date. And
>conversely, just because it fails at configure time does not mean it
>cannot succeed.

  The point isn't to test for "success" or "failure" (unless you've
found a solution to the halting problem, in which case I'm definitely
interested). The point is to have a decent heuristic for whether a
given function, identified by its name and signature, exists in your
system and has a reasonable chance of doing what you think it will do.
Is it perfect? No. Do we have a better way of writing portable software
that does not involve starting every single executable with a battery
of tests? Also no.


>  Writing your software in the above manner is therefore
>not sensible.

  Every single project using a configure script such as one created by
GNU autoconf, or a build system generator such as cmake or meson, is
therefore not sensible. That's fair, but maybe we should still try to
avoid breaking them?


>  Especially since the functions talked about here are
>system calls that on some architectures have been stubbed out in the
>kernel, so the run-time behavior depends on run-time kernel version.

  That's why, unfortunately, some functionality has to be documented as
depending on a run-time kernel version. It would be nice if we could
minimize the occurrences of having to document a dependency to a run-
time libc version, too.

--
  Laurent


  reply	other threads:[~2024-10-26 10:28 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-25 20:01 Alyssa Ross
2024-10-25 20:10 ` Rich Felker
2024-10-25 21:38   ` Alyssa Ross
2024-10-26  1:21     ` Re[2]: " Laurent Bercot
2024-10-26  1:57       ` Thorsten Glaser
2024-10-26  2:11         ` Rich Felker
2024-10-26  8:26       ` Markus Wichmann
2024-10-26 10:28         ` Laurent Bercot [this message]
2024-10-26 13:22           ` Markus Wichmann
2024-10-26 22:08             ` Thorsten Glaser
2024-10-26 23:03               ` Rich Felker
2024-10-30  9:28                 ` Alyssa Ross
2024-10-30 12:37                   ` enh
2024-10-26 23:35             ` Re[2]: " Laurent Bercot
2024-10-27 22:43             ` Yao Zi
2024-10-26 10:10       ` Robert Clausecker

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=emc3229b12-3f5c-4847-9cc7-49c0f43ca089@b9cddb74.com \
    --to=ska-dietlibc@skarnet.org \
    --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).