public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: Bruno Haible <bruno@clisp.org>
Cc: libc-alpha@sourceware.org,  bug-gnulib@gnu.org,
	Sachin Monga <smonga@linux.ibm.com>,
	Siddhesh Poyarekar <siddhesh@redhat.com>
Subject: Re: Updating <sys/cdefs.h> in glibc and gnulib
Date: Mon, 27 Feb 2023 15:52:03 +0100	[thread overview]
Message-ID: <87k003ma98.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <3069302.YxpEyTPbXf@nimes> (Bruno Haible's message of "Sun, 26 Feb 2023 20:02:58 +0100")

* Bruno Haible:

> Florian Weimer wrote:
>> Does gnulib still override <sys/cdefs.h> unconditionally?
>
> Gnulib does not override <sys/cdefs.h>, and never did.

Thanks for looking into this.  gnulib's libc-config.h does this:

| #ifndef __attribute_nonnull__
| /* <sys/cdefs.h> either does not exist, or is too old for Gnulib.
|    Prepare to include <cdefs.h>, which is Gnulib's version of a
|    more-recent glibc <sys/cdefs.h>.  */
| …
| /* Include our copy of glibc <sys/cdefs.h>.  */
| # include <cdefs.h>

And as gnulib's <cdefs.h> uses the same _SYS_CDEFS_H header guard as
glibc's, that effectively replaces <sys/cdefs.h> with gnulib's
<cdefs.h>.

> That is, when a package that uses Gnulib does
>   #include <sys/cdefs.h>
> it will get the <sys/cdefs.h> of the system (from glibc, *BSD, Cygwin,
> etc.).

Apparently not if it includes libc-config.h first.

I think what happened is that the order of backporting

commit 0b5ca7c3e551e5502f3be3b06453324fe8604e82
Author: Paul Eggert <eggert@cs.ucla.edu>
Date:   Tue Sep 21 07:47:45 2021 -0700

    regex: copy back from Gnulib

(which brought in __attribute_nonnull__) and

commit a643f60c53876be0d57b4b7373770e6cb356fd13
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Wed Oct 20 18:12:41 2021 +0530

    Make sure that the fortified function conditionals are constant

was reversed on the glibc 2.34 branch, so the version check based on
__attribute_nonnull__ would signal that system <sys/cdefs.h> is too old.
But with the second commit for fortified functions, glibc 2.34 headers
started requiring other macros not present in gnulib's <cdefs.h> copy,
so some projects using copied gnulib sources would start to fail.

I backported the regex sync to glibc 2.34 in November, so this should
now be solved because we now define __attribute_nonnull__ even on the
2.34 branch.  I think only the 2.34 branch had this problem.

I think we should have backported the __attribute_nonnull__-defining
commit to glibc 2.34 earlier, when we noticed problems.  Updating the
gnulib-bundled copy only (which is what happened at first) wasn't the
best resolution.

Thanks,
Florian


      reply	other threads:[~2023-02-27 14:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-21 10:14 Florian Weimer
2023-02-26 19:02 ` Bruno Haible
2023-02-27 14:52   ` Florian Weimer [this message]

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=87k003ma98.fsf@oldenburg.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=bruno@clisp.org \
    --cc=bug-gnulib@gnu.org \
    --cc=libc-alpha@sourceware.org \
    --cc=siddhesh@redhat.com \
    --cc=smonga@linux.ibm.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.
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 read-only IMAP folder(s) and NNTP newsgroup(s).