* [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2
@ 2025-07-10 9:12 Patrick Steinhardt
2025-07-10 9:14 ` Patrick Steinhardt
0 siblings, 1 reply; 7+ messages in thread
From: Patrick Steinhardt @ 2025-07-10 9:12 UTC (permalink / raw)
To: git; +Cc: Stan Hu, Patrick Steinhardt
Compiling Git fails on Amazon Linux 2 when using GCC 7.3.1 with the
following compiler error:
In file included from compat/posix.h:449:0,
from git-compat-util.h:26,
from daemon.c:3:
compat/../sane-ctype.h:29:60: error: expected expression before ']' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
compat/../sane-ctype.h:29:72: error: expected ')' before '!=' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
compat/../sane-ctype.h:29:60: error: expected expression before ']' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
... lots of similar lines ...
compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
#define toupper(x) sane_case((unsigned char)(x), 0)
^
/usr/include/ctype.h:142:12: error: expected identifier or '(' before 'int'
extern int isascii (int __c) __THROW;
^
compat/../sane-ctype.h:30:26: error: expected ')' before '&' token
#define isascii(x) (((x) & ~0x7f) == 0)
^
compat/../sane-ctype.h:30:35: error: expected ')' before '==' token
#define isascii(x) (((x) & ~0x7f) == 0)
^
In file included from /usr/include/features.h:423:0,
from /usr/include/unistd.h:25,
from compat/posix.h:90,
from git-compat-util.h:26,
from daemon.c:3:
compat/../sane-ctype.h:44:30: error: expected declaration specifiers or '...' before '(' token
#define tolower(x) sane_case((unsigned char)(x), 0x20)
^
compat/../sane-ctype.h:44:50: error: expected declaration specifiers or '...' before numeric constant
#define tolower(x) sane_case((unsigned char)(x), 0x20)
^
compat/../sane-ctype.h:45:30: error: expected declaration specifiers or '...' before '(' token
#define toupper(x) sane_case((unsigned char)(x), 0)
^
compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
#define toupper(x) sane_case((unsigned char)(x), 0)
^
This error bisect back to 75a044f748 (git-compat-util.h: split out
POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
"git-compat-util.h" into a new "compat/posix.h" header.
The compiler error isn't immediately obvious, doubly so because the
actual errors are ~3x as long as the above snippet. But what happens
here is that we transitively include <ctype.h> after we have included
our own "sane-ctype.h" header. Consequently, the function declarations
that exist in <ctype.h> for isascii(3p) et al will be mangled by our
macros of the same type. The result is of course completely broken.
It's unclear why this issue only happens on Amazon Linux 2. My guess is
that it's either specific to the compiler version or specific to the
glibc version. We don't explicitly include <ctypes.h> anywhere, but it's
being transitively included. So chances are that later versions of the
toolchain reorganized their headers so
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2
2025-07-10 9:12 [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2 Patrick Steinhardt
@ 2025-07-10 9:14 ` Patrick Steinhardt
2025-07-10 9:26 ` Patrick Steinhardt
0 siblings, 1 reply; 7+ messages in thread
From: Patrick Steinhardt @ 2025-07-10 9:14 UTC (permalink / raw)
To: git; +Cc: Stan Hu
On Thu, Jul 10, 2025 at 11:12:40AM +0200, Patrick Steinhardt wrote:
> Compiling Git fails on Amazon Linux 2 when using GCC 7.3.1 with the
> following compiler error:
>
> In file included from compat/posix.h:449:0,
> from git-compat-util.h:26,
> from daemon.c:3:
> compat/../sane-ctype.h:29:60: error: expected expression before ']' token
> #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
> ^
> compat/../sane-ctype.h:29:72: error: expected ')' before '!=' token
> #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
> ^
> compat/../sane-ctype.h:29:60: error: expected expression before ']' token
> #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
> ^
> ... lots of similar lines ...
>
> compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
> #define toupper(x) sane_case((unsigned char)(x), 0)
> ^
> /usr/include/ctype.h:142:12: error: expected identifier or '(' before 'int'
> extern int isascii (int __c) __THROW;
> ^
> compat/../sane-ctype.h:30:26: error: expected ')' before '&' token
> #define isascii(x) (((x) & ~0x7f) == 0)
> ^
> compat/../sane-ctype.h:30:35: error: expected ')' before '==' token
> #define isascii(x) (((x) & ~0x7f) == 0)
> ^
> In file included from /usr/include/features.h:423:0,
> from /usr/include/unistd.h:25,
> from compat/posix.h:90,
> from git-compat-util.h:26,
> from daemon.c:3:
> compat/../sane-ctype.h:44:30: error: expected declaration specifiers or '...' before '(' token
> #define tolower(x) sane_case((unsigned char)(x), 0x20)
> ^
> compat/../sane-ctype.h:44:50: error: expected declaration specifiers or '...' before numeric constant
> #define tolower(x) sane_case((unsigned char)(x), 0x20)
> ^
> compat/../sane-ctype.h:45:30: error: expected declaration specifiers or '...' before '(' token
> #define toupper(x) sane_case((unsigned char)(x), 0)
> ^
> compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
> #define toupper(x) sane_case((unsigned char)(x), 0)
> ^
>
> This error bisect back to 75a044f748 (git-compat-util.h: split out
> POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
> "git-compat-util.h" into a new "compat/posix.h" header.
>
> The compiler error isn't immediately obvious, doubly so because the
> actual errors are ~3x as long as the above snippet. But what happens
> here is that we transitively include <ctype.h> after we have included
> our own "sane-ctype.h" header. Consequently, the function declarations
> that exist in <ctype.h> for isascii(3p) et al will be mangled by our
> macros of the same type. The result is of course completely broken.
>
> It's unclear why this issue only happens on Amazon Linux 2. My guess is
> that it's either specific to the compiler version or specific to the
> glibc version. We don't explicitly include <ctypes.h> anywhere, but it's
> being transitively included. So chances are that later versions of the
> toolchain reorganized their headers so
Hrmpf, what's going on here? Both this email and the first one at [1]
are getting truncated... I'll debug.
Patrick
[1]: <20250710-pks-ctype-v1-1-c668b308d628@pks.im>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2
2025-07-10 9:14 ` Patrick Steinhardt
@ 2025-07-10 9:26 ` Patrick Steinhardt
2025-07-10 10:17 ` Toon Claes
2025-07-10 21:01 ` Junio C Hamano
0 siblings, 2 replies; 7+ messages in thread
From: Patrick Steinhardt @ 2025-07-10 9:26 UTC (permalink / raw)
To: git; +Cc: Stan Hu, Konstantin Ryabitsev
[-- Attachment #1: Type: text/plain, Size: 4394 bytes --]
On Thu, Jul 10, 2025 at 11:14:36AM +0200, Patrick Steinhardt wrote:
> On Thu, Jul 10, 2025 at 11:12:40AM +0200, Patrick Steinhardt wrote:
> > Compiling Git fails on Amazon Linux 2 when using GCC 7.3.1 with the
> > following compiler error:
> >
> > In file included from compat/posix.h:449:0,
> > from git-compat-util.h:26,
> > from daemon.c:3:
> > compat/../sane-ctype.h:29:60: error: expected expression before ']' token
> > #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
> > ^
> > compat/../sane-ctype.h:29:72: error: expected ')' before '!=' token
> > #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
> > ^
> > compat/../sane-ctype.h:29:60: error: expected expression before ']' token
> > #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
> > ^
> > ... lots of similar lines ...
> >
> > compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
> > #define toupper(x) sane_case((unsigned char)(x), 0)
> > ^
> > /usr/include/ctype.h:142:12: error: expected identifier or '(' before 'int'
> > extern int isascii (int __c) __THROW;
> > ^
> > compat/../sane-ctype.h:30:26: error: expected ')' before '&' token
> > #define isascii(x) (((x) & ~0x7f) == 0)
> > ^
> > compat/../sane-ctype.h:30:35: error: expected ')' before '==' token
> > #define isascii(x) (((x) & ~0x7f) == 0)
> > ^
> > In file included from /usr/include/features.h:423:0,
> > from /usr/include/unistd.h:25,
> > from compat/posix.h:90,
> > from git-compat-util.h:26,
> > from daemon.c:3:
> > compat/../sane-ctype.h:44:30: error: expected declaration specifiers or '...' before '(' token
> > #define tolower(x) sane_case((unsigned char)(x), 0x20)
> > ^
> > compat/../sane-ctype.h:44:50: error: expected declaration specifiers or '...' before numeric constant
> > #define tolower(x) sane_case((unsigned char)(x), 0x20)
> > ^
> > compat/../sane-ctype.h:45:30: error: expected declaration specifiers or '...' before '(' token
> > #define toupper(x) sane_case((unsigned char)(x), 0)
> > ^
> > compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
> > #define toupper(x) sane_case((unsigned char)(x), 0)
> > ^
> >
> > This error bisect back to 75a044f748 (git-compat-util.h: split out
> > POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
> > "git-compat-util.h" into a new "compat/posix.h" header.
> >
> > The compiler error isn't immediately obvious, doubly so because the
> > actual errors are ~3x as long as the above snippet. But what happens
> > here is that we transitively include <ctype.h> after we have included
> > our own "sane-ctype.h" header. Consequently, the function declarations
> > that exist in <ctype.h> for isascii(3p) et al will be mangled by our
> > macros of the same type. The result is of course completely broken.
> >
> > It's unclear why this issue only happens on Amazon Linux 2. My guess is
> > that it's either specific to the compiler version or specific to the
> > glibc version. We don't explicitly include <ctypes.h> anywhere, but it's
> > being transitively included. So chances are that later versions of the
> > toolchain reorganized their headers so
>
> Hrmpf, what's going on here? Both this email and the first one at [1]
> are getting truncated... I'll debug.
I've tested with multiple other recipients, works alright there. No
truncation, the mail comes through as expected. I'm a bit clueless right
now. Konstantin, do you have any idea why this might have happened?
Meanwhile, I'll include the patch as an attachment.
Patrick
[-- Attachment #2: 0001-sane-ctype-fix-compiler-error-on-Amazon-Linux-2.patch --]
[-- Type: text/plain, Size: 5063 bytes --]
From fabacc9bc7ef7d462d1c7198d5edc18c76b82270 Mon Sep 17 00:00:00 2001
Message-ID: <fabacc9bc7ef7d462d1c7198d5edc18c76b82270.1752139420.git.ps@pks.im>
From: Patrick Steinhardt <ps@pks.im>
Date: Thu, 10 Jul 2025 08:46:27 +0200
Subject: [PATCH] sane-ctype: fix compiler error on Amazon Linux 2
Compiling Git fails on Amazon Linux 2 when using GCC 7.3.1 with the
following compiler error:
In file included from compat/posix.h:449:0,
from git-compat-util.h:26,
from daemon.c:3:
compat/../sane-ctype.h:29:60: error: expected expression before ']' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
compat/../sane-ctype.h:29:72: error: expected ')' before '!=' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
compat/../sane-ctype.h:29:60: error: expected expression before ']' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
... lots of similar lines ...
compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
#define toupper(x) sane_case((unsigned char)(x), 0)
^
/usr/include/ctype.h:142:12: error: expected identifier or '(' before 'int'
extern int isascii (int __c) __THROW;
^
compat/../sane-ctype.h:30:26: error: expected ')' before '&' token
#define isascii(x) (((x) & ~0x7f) == 0)
^
compat/../sane-ctype.h:30:35: error: expected ')' before '==' token
#define isascii(x) (((x) & ~0x7f) == 0)
^
In file included from /usr/include/features.h:423:0,
from /usr/include/unistd.h:25,
from compat/posix.h:90,
from git-compat-util.h:26,
from daemon.c:3:
compat/../sane-ctype.h:44:30: error: expected declaration specifiers or '...' before '(' token
#define tolower(x) sane_case((unsigned char)(x), 0x20)
^
compat/../sane-ctype.h:44:50: error: expected declaration specifiers or '...' before numeric constant
#define tolower(x) sane_case((unsigned char)(x), 0x20)
^
compat/../sane-ctype.h:45:30: error: expected declaration specifiers or '...' before '(' token
#define toupper(x) sane_case((unsigned char)(x), 0)
^
compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
#define toupper(x) sane_case((unsigned char)(x), 0)
^
This error bisect back to 75a044f748 (git-compat-util.h: split out
POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
"git-compat-util.h" into a new "compat/posix.h" header.
The compiler error isn't immediately obvious, doubly so because the
actual errors are ~3x as long as the above snippet. But what happens
here is that we transitively include <ctype.h> after we have included
our own "sane-ctype.h" header. Consequently, the function declarations
that exist in <ctype.h> for isascii(3p) et al will be mangled by our
macros of the same type. The result is of course completely broken.
It's unclear why this issue only happens on Amazon Linux 2. My guess is
that it's either specific to the compiler version or specific to the
glibc version. We don't explicitly include <ctypes.h> anywhere, but it's
being transitively included. So chances are that later versions of the
toolchain reorganized their headers so that <ctypes.h> is not included
transitively anymore.
Fix the issue by explicitly including <ctype.h> in "sane-ctype.h". This
ensures that the header guards will be activated and that any subsequent
include of the same header will become a no-op. With this we can then
safely override the function declarations with our own macros.
Reported-by: Stan Hu <stanhu@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
sane-ctype.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sane-ctype.h b/sane-ctype.h
index cbea1b299b7..4f476c43816 100644
--- a/sane-ctype.h
+++ b/sane-ctype.h
@@ -1,6 +1,15 @@
#ifndef SANE_CTYPE_H
#define SANE_CTYPE_H
+/*
+ * Explicitly include <ctype.h> so that its header guards kick in from here on.
+ * This ensures that the file won't get included after "sane-ctype.h", as that
+ * would otherwise lead to a compiler error because the function declarations
+ * for `int isascii(int c)` et al would be mangled by our macros with the same
+ * name.
+ */
+#include <ctype.h>
+
/* Sane ctype - no locale, and works with signed chars */
#undef isascii
#undef isspace
--
2.50.1.337.g200b4b24a8.dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2
2025-07-10 9:26 ` Patrick Steinhardt
@ 2025-07-10 10:17 ` Toon Claes
2025-07-10 21:01 ` Junio C Hamano
1 sibling, 0 replies; 7+ messages in thread
From: Toon Claes @ 2025-07-10 10:17 UTC (permalink / raw)
To: Patrick Steinhardt, git; +Cc: Stan Hu, Konstantin Ryabitsev
Patrick Steinhardt <ps@pks.im> writes:
> Meanwhile, I'll include the patch as an attachment.
I have tested the patch on the Docker image we saw the failure on and
this patch fixes the issue.
If anyone is curious, on that system <ctype.h> is included through:
In file included from /usr/include/openssl/kssl.h:72:0,
from /usr/include/openssl/ssl.h:165,
from git-compat-util.h:226
Doesn't matter much, because the patch makes sense to me.
--
Cheers,
Toon
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2
2025-07-10 9:26 ` Patrick Steinhardt
2025-07-10 10:17 ` Toon Claes
@ 2025-07-10 21:01 ` Junio C Hamano
2025-07-11 7:56 ` Patrick Steinhardt
1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2025-07-10 21:01 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Stan Hu, Konstantin Ryabitsev
Patrick Steinhardt <ps@pks.im> writes:
>> > This error bisect back to 75a044f748 (git-compat-util.h: split out
>> > POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
>> > "git-compat-util.h" into a new "compat/posix.h" header.
So there was a subtle change in the inclusion order or something,
i.e. we used to include <sane-ctype.h> a lot earlier as part of the
<git-compat-util.h> that tightly controls inclusion order exactly to
avoid this kind of problems, but that has eroded recently?
In any case, it means that our definitions in <sane-ctype.h> will be
overwritten if we allow system-supplied <ctype.h> included, and this
is an obvious workaround, likely to remain correct as long as their
<ctype.h> is not so broken to allow multiple inclusion.
For those who are reading from the sidelines, here is the patch in
inline form.
--- >8 ---
Subject: [PATCH] sane-ctype: fix compiler error on Amazon Linux 2
From: Patrick Steinhardt <ps@pks.im>
Compiling Git fails on Amazon Linux 2 when using GCC 7.3.1 with the
following compiler error:
In file included from compat/posix.h:449:0,
from git-compat-util.h:26,
from daemon.c:3:
compat/../sane-ctype.h:29:60: error: expected expression before ']' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
compat/../sane-ctype.h:29:72: error: expected ')' before '!=' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
compat/../sane-ctype.h:29:60: error: expected expression before ']' token
#define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0)
^
... lots of similar lines ...
compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
#define toupper(x) sane_case((unsigned char)(x), 0)
^
/usr/include/ctype.h:142:12: error: expected identifier or '(' before 'int'
extern int isascii (int __c) __THROW;
^
compat/../sane-ctype.h:30:26: error: expected ')' before '&' token
#define isascii(x) (((x) & ~0x7f) == 0)
^
compat/../sane-ctype.h:30:35: error: expected ')' before '==' token
#define isascii(x) (((x) & ~0x7f) == 0)
^
In file included from /usr/include/features.h:423:0,
from /usr/include/unistd.h:25,
from compat/posix.h:90,
from git-compat-util.h:26,
from daemon.c:3:
compat/../sane-ctype.h:44:30: error: expected declaration specifiers or '...' before '(' token
#define tolower(x) sane_case((unsigned char)(x), 0x20)
^
compat/../sane-ctype.h:44:50: error: expected declaration specifiers or '...' before numeric constant
#define tolower(x) sane_case((unsigned char)(x), 0x20)
^
compat/../sane-ctype.h:45:30: error: expected declaration specifiers or '...' before '(' token
#define toupper(x) sane_case((unsigned char)(x), 0)
^
compat/../sane-ctype.h:45:50: error: expected declaration specifiers or '...' before numeric constant
#define toupper(x) sane_case((unsigned char)(x), 0)
^
This error bisect back to 75a044f748 (git-compat-util.h: split out
POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
"git-compat-util.h" into a new "compat/posix.h" header.
The compiler error isn't immediately obvious, doubly so because the
actual errors are ~3x as long as the above snippet. But what happens
here is that we transitively include <ctype.h> after we have included
our own "sane-ctype.h" header. Consequently, the function declarations
that exist in <ctype.h> for isascii(3p) et al will be mangled by our
macros of the same type. The result is of course completely broken.
It's unclear why this issue only happens on Amazon Linux 2. My guess is
that it's either specific to the compiler version or specific to the
glibc version. We don't explicitly include <ctypes.h> anywhere, but it's
being transitively included. So chances are that later versions of the
toolchain reorganized their headers so that <ctypes.h> is not included
transitively anymore.
Fix the issue by explicitly including <ctype.h> in "sane-ctype.h". This
ensures that the header guards will be activated and that any subsequent
include of the same header will become a no-op. With this we can then
safely override the function declarations with our own macros.
Reported-by: Stan Hu <stanhu@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
---
sane-ctype.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/sane-ctype.h b/sane-ctype.h
index cbea1b299b7..4f476c43816 100644
--- a/sane-ctype.h
+++ b/sane-ctype.h
@@ -1,6 +1,15 @@
#ifndef SANE_CTYPE_H
#define SANE_CTYPE_H
+/*
+ * Explicitly include <ctype.h> so that its header guards kick in from here on.
+ * This ensures that the file won't get included after "sane-ctype.h", as that
+ * would otherwise lead to a compiler error because the function declarations
+ * for `int isascii(int c)` et al would be mangled by our macros with the same
+ * name.
+ */
+#include <ctype.h>
+
/* Sane ctype - no locale, and works with signed chars */
#undef isascii
#undef isspace
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2
2025-07-10 21:01 ` Junio C Hamano
@ 2025-07-11 7:56 ` Patrick Steinhardt
2025-07-11 15:11 ` Junio C Hamano
0 siblings, 1 reply; 7+ messages in thread
From: Patrick Steinhardt @ 2025-07-11 7:56 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, Stan Hu, Konstantin Ryabitsev
On Thu, Jul 10, 2025 at 02:01:15PM -0700, Junio C Hamano wrote:
> Patrick Steinhardt <ps@pks.im> writes:
>
> >> > This error bisect back to 75a044f748 (git-compat-util.h: split out
> >> > POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
> >> > "git-compat-util.h" into a new "compat/posix.h" header.
>
> So there was a subtle change in the inclusion order or something,
> i.e. we used to include <sane-ctype.h> a lot earlier as part of the
> <git-compat-util.h> that tightly controls inclusion order exactly to
> avoid this kind of problems, but that has eroded recently?
>
> In any case, it means that our definitions in <sane-ctype.h> will be
> overwritten if we allow system-supplied <ctype.h> included, and this
> is an obvious workaround, likely to remain correct as long as their
> <ctype.h> is not so broken to allow multiple inclusion.
Yup, exactly. Toon figured out that this is actually neither glibc nor
GCC that causes this -- it's OpenSSL that transitively pulls in
<ctype.h>. Later versions of OpenSSL seem to not do that anymore.
I can reroll and update the commit message, but am a bit hesitant given
that I wasn't able to send out this mail in the first place due to
whatever reason :/
Patrick
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2
2025-07-11 7:56 ` Patrick Steinhardt
@ 2025-07-11 15:11 ` Junio C Hamano
0 siblings, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2025-07-11 15:11 UTC (permalink / raw)
To: Patrick Steinhardt; +Cc: git, Stan Hu, Konstantin Ryabitsev
Patrick Steinhardt <ps@pks.im> writes:
> On Thu, Jul 10, 2025 at 02:01:15PM -0700, Junio C Hamano wrote:
>> Patrick Steinhardt <ps@pks.im> writes:
>>
>> >> > This error bisect back to 75a044f748 (git-compat-util.h: split out
>> >> > POSIX-emulating bits, 2025-02-18), where lots of bits got split out of
>> >> > "git-compat-util.h" into a new "compat/posix.h" header.
>>
>> So there was a subtle change in the inclusion order or something,
>> i.e. we used to include <sane-ctype.h> a lot earlier as part of the
>> <git-compat-util.h> that tightly controls inclusion order exactly to
>> avoid this kind of problems, but that has eroded recently?
>>
>> In any case, it means that our definitions in <sane-ctype.h> will be
>> overwritten if we allow system-supplied <ctype.h> included, and this
>> is an obvious workaround, likely to remain correct as long as their
>> <ctype.h> is not so broken to allow multiple inclusion.
>
> Yup, exactly. Toon figured out that this is actually neither glibc nor
> GCC that causes this -- it's OpenSSL that transitively pulls in
> <ctype.h>. Later versions of OpenSSL seem to not do that anymore.
>
> I can reroll and update the commit message, but am a bit hesitant given
> that I wasn't able to send out this mail in the first place due to
> whatever reason :/
I did not see much need to update the proposed log message; I was
merely trying to make sure I understand what motivation and
assumption are behind the change.
It does make me curious what in your original message got it
truncated. If you received the message you are responding to in
full, that means there is not something funky in the diff output
;-), but then I do not know what it is in your original message,
either.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-07-11 15:11 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-10 9:12 [PATCH RESEND] sane-ctype: fix compiler error on Amazon Linux 2 Patrick Steinhardt
2025-07-10 9:14 ` Patrick Steinhardt
2025-07-10 9:26 ` Patrick Steinhardt
2025-07-10 10:17 ` Toon Claes
2025-07-10 21:01 ` Junio C Hamano
2025-07-11 7:56 ` Patrick Steinhardt
2025-07-11 15:11 ` Junio C Hamano
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).