From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: musl@lists.openwall.com
Subject: [musl] getpass() feature test macro
Date: Wed, 9 Jul 2025 23:52:42 +0200 [thread overview]
Message-ID: <20250709235242.6ab2aaeb@windsurf> (raw)
Hello,
I am working on a build failure happening with the gcr package
(https://gitlab.gnome.org/GNOME/gcr/) due to its use of the getpass()
function in:
https://gitlab.gnome.org/GNOME/gcr/-/blob/main/gcr/console-interaction.c?ref_type=heads
This fails to build with gcc >= 14 musl toolchains because it doesn't
find the prototype for getpass() even though it's defined in <unistd.h>
which is included.
musl provides the getpass() prototype when:
#if defined(_GNU_SOURCE) || defined(_BSD_SOURCE)
glibc provides the getpass() prototype when:
#if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
The gcr code base is built with _XOPEN_SOURCE defined, so the build
works fine with glibc, but not with musl.
According to https://man7.org/linux/man-pages/man3/getpass.3.html the
feature test macro requirements for glibc are:
getpass():
Since glibc 2.2.2:
_XOPEN_SOURCE && ! (_POSIX_C_SOURCE >= 200112L)
|| /* glibc >= 2.19: */ _DEFAULT_SOURCE
|| /* glibc <= 2.19: */ _BSD_SOURCE
Before glibc 2.2.2:
none
So, now the $100 question is: is it gcr that needs to be fixed to
define another feature macro (and if so, which one), or is it musl's
code that should provide getpass() prototype under different conditions?
Thanks a lot in advance for your feedback!
(Obviously the feedback of "getpass is legacy and sucks" isn't very
useful, as it's not the point of this discussion and this fact is known
and understood.)
Thomas
--
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
next reply other threads:[~2025-07-09 21:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-09 21:52 Thomas Petazzoni [this message]
2025-07-09 22:20 ` getpass() feature test macro Thorsten Glaser
2025-07-09 23:56 ` [musl] " Rich Felker
2025-07-10 7:55 ` Thomas Petazzoni
2025-07-10 15:54 ` Rich Felker
2025-07-10 15:56 ` Thomas Petazzoni
2025-07-10 16:01 ` Rich Felker
2025-07-10 16:13 ` Thomas Petazzoni
2025-07-10 16:40 ` Rich Felker
2025-07-11 19:16 ` Thorsten Glaser
2025-07-11 0:46 ` [musl] " Haelwenn (lanodan) Monnier
2025-07-11 0:58 ` Haelwenn (lanodan) Monnier
2025-07-11 1:18 ` A. Wilcox
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=20250709235242.6ab2aaeb@windsurf \
--to=thomas.petazzoni@bootlin.com \
--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).