Skip to content

libmodsecurity: remove dependency on valgrind#173558

Merged
SuperSandro2000 merged 1 commit intoNixOS:masterfrom
lopsided98:libmodsecurity-remove-valgrind
May 19, 2022
Merged

libmodsecurity: remove dependency on valgrind#173558
SuperSandro2000 merged 1 commit intoNixOS:masterfrom
lopsided98:libmodsecurity-remove-valgrind

Conversation

@lopsided98
Copy link
Contributor

Description of changes

valgrind is only supported on certain platforms (it notably lacks support for armv6l), so needs to be excluded as a dependency on unsupported platforms. In this case, it turns out that valgrind is not currently used at all, so I removed it entirely. libmodsecurity can optionally use valgrind to run tests, but we don't run the tests at all.

Note that I don't actually use libmodsecurity, but tengine depends on it and is evaluated as part of the nginx NixOS module even if it is not used: #147027 (comment)

Things done
  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandbox = true set in nix.conf? (See Nix manual)
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 22.05 Release Notes (or backporting 21.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
    • (Release notes changes) Ran nixos/doc/manual/md-to-db.sh to update generated release notes
  • Fits CONTRIBUTING.md.

valgrind is only supported on certain platforms (it notably lacks support for
armv6l), so needs to be excluded as a dependency on unsupported platforms. In
this case, it turns out that valgrind is not currently used at all, so I
removed it entirely. libmodsecurity can optionally use valgrind to run
tests, but we don't run the tests at all.
@ofborg ofborg bot requested a review from Izorkin May 19, 2022 01:32
@ofborg ofborg bot added 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux. labels May 19, 2022
@Izorkin
Copy link
Contributor

Izorkin commented May 19, 2022

Maybe this variant is better?

diff --git a/pkgs/tools/security/libmodsecurity/default.nix b/pkgs/tools/security/libmodsecurity/default.nix
index 4ba294e42f2..c22dc9f5321 100644
--- a/pkgs/tools/security/libmodsecurity/default.nix
+++ b/pkgs/tools/security/libmodsecurity/default.nix
@@ -1,7 +1,8 @@
 { lib, stdenv, fetchFromGitHub
 , autoreconfHook, bison, flex, pkg-config
 , curl, geoip, libmaxminddb, libxml2, lmdb, lua, pcre
-, ssdeep, valgrind, yajl
+, ssdeep, yajl
+, withValgrind ? false, valgrind
 , nixosTests
 }:

@@ -18,7 +19,7 @@ stdenv.mkDerivation rec {
   };

   nativeBuildInputs = [ autoreconfHook bison flex pkg-config ];
-  buildInputs = [ curl geoip libmaxminddb libxml2 lmdb lua pcre ssdeep valgrind yajl ];
+  buildInputs = [ curl geoip libmaxminddb libxml2 lmdb lua pcre ssdeep yajl ] ++ lib.optional withValgrind valgrind;

   outputs = [ "out" "dev" ];

@lopsided98
Copy link
Contributor Author

lopsided98 commented May 19, 2022

Why? Valgrind is not currently used as far as I can tell. It certainly doesn't end up in the output closure.

If we ever wanted to run the tests, then it might make sense to do withValgrind ? lib.meta.availableOn stdenv.hostPlatform valgrind, but for now it is just unnecessarily increasing the build closure size.

@Izorkin
Copy link
Contributor

Izorkin commented May 19, 2022

I assumed that libmodsecurity uses valgrind for some specific operations. Or I'm wrong?

@SuperSandro2000
Copy link
Member

valgrind is used for testing which we are not doing (but we should) and debugging which usually requires additional tools we don't install by default.

@SuperSandro2000 SuperSandro2000 merged commit 2f32f52 into NixOS:master May 19, 2022
@lopsided98 lopsided98 deleted the libmodsecurity-remove-valgrind branch May 19, 2022 22:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 1-10 This PR causes between 1 and 10 packages to rebuild on Linux.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants