From 024e4447a42868b4c8f3ac8b3e6a2da83c682de1 Mon Sep 17 00:00:00 2001 From: David Guibert Date: Mon, 27 Nov 2023 21:54:14 +0100 Subject: [PATCH] paraview: fix strlcat symbol provided by glibc 2.38 Glibc introduces strlcat in commit [1]. The logic of vtknetcdf was to only define strlcat conditionally on not BSD systems, but starting with glibc 2.38, strlcat is also defined on Linux. The CMakelist checks for the symbol existence, the redefinition of the symbol can be conditional on the boolean HAVE_STRLCAT instead of if not BSD systems. This commit fixes 268961. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=454a20c8756c9c1d55419153255fc7692b3d2199 --- .../graphics/paraview/default.nix | 4 +++ .../paraview/dont-redefine-strlcat.patch | 28 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 pkgs/applications/graphics/paraview/dont-redefine-strlcat.patch diff --git a/pkgs/applications/graphics/paraview/default.nix b/pkgs/applications/graphics/paraview/default.nix index 14c86082e671..48b98b36d5c4 100644 --- a/pkgs/applications/graphics/paraview/default.nix +++ b/pkgs/applications/graphics/paraview/default.nix @@ -86,6 +86,10 @@ in stdenv.mkDerivation rec { qtsvg ]; + patches = [ + ./dont-redefine-strlcat.patch + ]; + postInstall = let docDir = "$out/share/paraview-${lib.versions.majorMinor version}/doc"; in lib.optionalString withDocs '' mkdir -p ${docDir}; diff --git a/pkgs/applications/graphics/paraview/dont-redefine-strlcat.patch b/pkgs/applications/graphics/paraview/dont-redefine-strlcat.patch new file mode 100644 index 000000000000..d7e24e7d7305 --- /dev/null +++ b/pkgs/applications/graphics/paraview/dont-redefine-strlcat.patch @@ -0,0 +1,28 @@ +--- a/VTK/ThirdParty/netcdf/vtknetcdf/include/vtk_netcdf_mangle.h 2023-11-27 21:11:33.562949964 +0100 ++++ b/VTK/ThirdParty/netcdf/vtknetcdf/include/vtk_netcdf_mangle.h 2023-11-27 21:11:33.562949964 +0100 +@@ -1246,7 +1246,7 @@ + #define write_numrecs vtknetcdf_write_numrecs + + /* Only define strlcat conditionally, as it's provided by system headers on the BSDs. */ +-#if !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__NetBSD__) && !defined(__OpenBSD__) && !defined(_BSD_SOURCE) ++#ifndef HAVE_STRLCAT + #define strlcat vtknetcdf_strlcat + #endif + +--- a/VTK/ThirdParty/netcdf/vtknetcdf/config.h.in 2023-11-27 21:10:35.113525241 +0100 ++++ b/VTK/ThirdParty/netcdf/vtknetcdf/config.h.in 2023-11-27 21:10:55.241982399 +0100 +@@ -1,7 +1,5 @@ + /* config.h.in. Generated from configure.ac by autoheader. */ + +-#include "vtk_netcdf_mangle.h" +- + /* Define if building universal (internal helper macro) */ + #cmakedefine AC_APPLE_UNIVERSAL_BUILD + +@@ -621,4 +619,6 @@ + #endif + #endif + ++#include "vtk_netcdf_mangle.h" ++ + #include "ncconfigure.h"