git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Audrey Dutcher <audrey@rhelmot.io>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] git-compat-util.h: Bump _XOPEN_SOURCE on OpenBSD
Date: Fri, 21 Feb 2025 12:34:59 -0800	[thread overview]
Message-ID: <xmqqeczr9guk.fsf@gitster.g> (raw)
In-Reply-To: <20250221180225.3176533-1-audrey@rhelmot.io> (Audrey Dutcher's message of "Fri, 21 Feb 2025 11:02:25 -0700")

Audrey Dutcher <audrey@rhelmot.io> writes:

> On OpenBSD, getdelim() in <stdio.h> is behind __POSIX_VISIBLE >= 200809,
> which is in turn locked behind _XOPEN_SOURCE >= 700. Without this patch,
> compiling on OpenBSD 7.5 or 7.6, we get implicit declaration errors
> when compiling with -Werror=implicit-function-declaration (default in
> clang 19).

Is this a recent regression?  Blaming these two line ranges ...

>
> [1] https://github.com/openbsd/src/blob/6a403588e27467d1f271831ca1de62a3befea6a0/include/stdio.h#L236-L237
> [2] https://github.com/openbsd/src/blob/6a403588e27467d1f271831ca1de62a3befea6a0/sys/sys/cdefs.h#L299-L302

... in the OpenBSD repository says they haven't changed for many
years, and I am wondering what triggered this all of a sudden.

If we know how we used to have no issue, in addition to how we now
have issue with the current OpenBSD (which you outlined very well
above), and when the situation changed, please add to the proposed
log message.  That would help people on OpenBSD to decide when they
want to upgrade their copy of Git.

> Signed-off-by: Audrey Dutcher <audrey@rhelmot.io>
> ---
>  git-compat-util.h | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-compat-util.h b/git-compat-util.h
> index e123288e8f..f6902ca2e8 100644
> --- a/git-compat-util.h
> +++ b/git-compat-util.h
> @@ -195,7 +195,7 @@ DISABLE_WARNING(-Wsign-compare)
>        !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \
>        !defined(__TANDEM) && !defined(__QNX__) && !defined(__MirBSD__) && \
>        !defined(__CYGWIN__)
> -#define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */
> +#define _XOPEN_SOURCE 700 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 700 for getdelim() */

Also, I am wondering if this "A and B needs only 500 but C needs
600, hence require 600 from all three" is a healthy thing to
continue.  How bad it would become to split C at least from A and B,
to give it an independent status, i.e. leaving the above line as-is,
but insert

	#elif defined(OPENBSD)
	#define _XOPEN_SOURCE 700

before the existing catchall
"#elif !defined(__APPLE__) && !defined(__FreeBSD__) ..."  line?

If there is somebody stilll on AIX who can test, we might go further
by separating it out as well, but that would be a separate project
that should be handled outside the scope of adjusting for OpenBSD.

Thanks.


>  #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */
>  #endif
>  #define _ALL_SOURCE 1

  reply	other threads:[~2025-02-21 20:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-02-21 18:02 [PATCH] git-compat-util.h: Bump _XOPEN_SOURCE on OpenBSD Audrey Dutcher
2025-02-21 20:34 ` Junio C Hamano [this message]
2025-02-21 20:41   ` Audrey Dutcher
2025-02-21 20:54     ` Jeff King
2025-02-22  2:07     ` Junio C Hamano

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=xmqqeczr9guk.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=audrey@rhelmot.io \
    --cc=git@vger.kernel.org \
    /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.
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).