diff --git a/nix/ext/patches/supautils-strtol-glibc-compat.patch b/nix/ext/patches/supautils-strtol-glibc-compat.patch index 06f846b91f..8c36e613d9 100644 --- a/nix/ext/patches/supautils-strtol-glibc-compat.patch +++ b/nix/ext/patches/supautils-strtol-glibc-compat.patch @@ -26,4 +26,31 @@ index 18e5aee..cdfb63f 100644 + static JSON_ACTION_RETURN_TYPE json_array_start(void *state) { json_constrained_extension_parse_state *parse = state; + +diff --git a/src/extension_custom_scripts.c b/src/extension_custom_scripts.c +index 337bd69..3f285cc 100644 +--- a/src/extension_custom_scripts.c ++++ b/src/extension_custom_scripts.c +@@ -2,6 +2,22 @@ + #include + #include + ++#if defined(__linux__) && defined(__GLIBC__) && (defined(__x86_64__) || defined(__aarch64__)) ++# if defined(__x86_64__) ++# define SUPAUTILS_STAT_COMPAT_VER "GLIBC_2.2.5" ++# define SUPAUTILS_STAT_VER 1 ++# else ++# define SUPAUTILS_STAT_COMPAT_VER "GLIBC_2.17" ++# define SUPAUTILS_STAT_VER 0 ++# endif ++extern int __xstat(int ver, const char *path, struct stat *buf); ++__asm__(".symver __xstat,__xstat@" SUPAUTILS_STAT_COMPAT_VER); ++#undef stat ++#define stat(path, buf) __xstat(SUPAUTILS_STAT_VER, path, buf) ++#undef stat64 ++#define stat64(path, buf) __xstat(SUPAUTILS_STAT_VER, path, buf) ++#endif ++ + // Prevent recursively running custom scripts + static bool running_custom_script = false; diff --git a/nix/ext/supautils.nix b/nix/ext/supautils.nix index 5712df47a5..aff35bf9bc 100644 --- a/nix/ext/supautils.nix +++ b/nix/ext/supautils.nix @@ -24,6 +24,7 @@ stdenv.mkDerivation rec { hash = "sha256-Wsou5U7/Tuwj2E6aPEmlHg7uz7kGyBOGrb7UkjfEo9U="; }; + # remove once all Ubuntu 20.04 (glibc 2.31) hosts are decommissioned patches = [ ./patches/supautils-strtol-glibc-compat.patch ]; installPhase = ''