Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250710164021.GX1827@brightrain.aerifal.cx>
Date: Thu, 10 Jul 2025 12:40:21 -0400
From: Rich Felker <dalias@...c.org>
To: Thomas Petazzoni <thomas.petazzoni@...tlin.com>
Cc: Thorsten Glaser <tg@...bsd.de>, musl@...ts.openwall.com
Subject: Re: getpass() feature test macro

On Thu, Jul 10, 2025 at 06:13:53PM +0200, Thomas Petazzoni wrote:
> On Thu, 10 Jul 2025 12:01:30 -0400
> Rich Felker <dalias@...c.org> wrote:
> 
> > It's called _DEFAULT_SOURCE because it's what's exposed by default
> > (defined by default) if no more restrictive FTMs were already defined.
> 
> But they are defining _XOPEN_SOURCE because they use strptime(), which
> requires _XOPEN_SOURCE.

It only "requires _XOPEN_SOURCE" if you're writing code that defines
_POSIX_SOURCE or (via -std=...) __STRICT_ANSI__ such that you're
starting with a very strict namespace that doesn't expose anything
outside of it.

There are two options here. Either:

1. You stick to strictly following the standards, and not using things
   outside them, and declare that intention with one or more of the
   standards-specified feature test macros, or

2. You write to "whatever your platform has by default or as
   extensions", leaving the standard FTMs undefined or also defining
   the appropriate extension FTMs to get whatever extensions you want.

What this program seems to be doing is requesting a strict standards
environment and then expecting to be able to use something that's not
part of the standard.

So either drop _XOPEN_SOURCE, drop use of getpass, or add explicit
_BSD_SOURCE or _DEFAULT_SOURCE to get some extensions.

Rich

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.