From 7046f09fe464d6959209793e48d987635f4da156 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Sun, 9 Oct 2022 11:16:11 +0200 Subject: [PATCH] xorg.xdm: fix build w/glibc-2.36 Failing Hydra build: https://hydra.nixos.org/build/193323749 --- pkgs/servers/x11/xorg/overrides.nix | 1 + .../x11/xorg/xdm-fix-header-inclusion.patch | 29 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/servers/x11/xorg/xdm-fix-header-inclusion.patch diff --git a/pkgs/servers/x11/xorg/overrides.nix b/pkgs/servers/x11/xorg/overrides.nix index 7438f35e74b3..fe572da71565 100644 --- a/pkgs/servers/x11/xorg/overrides.nix +++ b/pkgs/servers/x11/xorg/overrides.nix @@ -164,6 +164,7 @@ self: super: }); xdm = super.xdm.overrideAttrs (attrs: { + patches = (attrs.patches or []) ++ [ ./xdm-fix-header-inclusion.patch ]; buildInputs = attrs.buildInputs ++ [ libxcrypt ]; configureFlags = attrs.configureFlags or [] ++ [ "ac_cv_path_RAWCPP=${stdenv.cc.targetPrefix}cpp" diff --git a/pkgs/servers/x11/xorg/xdm-fix-header-inclusion.patch b/pkgs/servers/x11/xorg/xdm-fix-header-inclusion.patch new file mode 100644 index 000000000000..7bde988aefd1 --- /dev/null +++ b/pkgs/servers/x11/xorg/xdm-fix-header-inclusion.patch @@ -0,0 +1,29 @@ +On glibc-2.36 this fails with + + genauth.c:45:12: fatal error: bsd/stdlib.h: No such file or directory + 45 | # include + | ^~~~~~~~~~~~~~ + +This is because the file will be included if HAVE_ARC4RANDOM is true and `__linux__` is set. +However, this is wrong: arc4random is now defined in glibc-2.36 and thus stdlib.h must be included +even though HAVE_ARC4RANDOM is true. + +diff --git a/xdm/genauth.c b/xdm/genauth.c +index cd2ad61..74d0ae1 100644 +--- a/xdm/genauth.c ++++ b/xdm/genauth.c +@@ -40,13 +40,7 @@ from The Open Group. + + #include + +-#ifdef HAVE_ARC4RANDOM +-# ifdef __linux__ +-# include +-# else +-# include +-# endif +-#endif ++#include + + #include + #define Time_t time_t