diff --git a/pkgs/development/php-packages/gnupg/default.nix b/pkgs/development/php-packages/gnupg/default.nix index 9cfa7e0eaafb..4476f7a88ea6 100644 --- a/pkgs/development/php-packages/gnupg/default.nix +++ b/pkgs/development/php-packages/gnupg/default.nix @@ -6,6 +6,7 @@ gnupg, php, fetchFromGitHub, + fetchpatch, }: let @@ -41,11 +42,24 @@ buildPecl { substituteInPlace tests/gnupg_oo_init_file_name.phpt \ --replace-fail '/usr/bin/gpg' '${gnupg}/bin/gpg' \ --replace-fail 'string(12)' 'string(${toString (lib.stringLength "${gnupg}/bin/gpg")})' + # Suppress warnings from unlinking socket files that gpg-agent may have + # already removed during shutdown (TOCTOU race in cleanup code). + substituteInPlace tests/gnupgt.inc \ + --replace-fail 'unlink(' '@unlink(' ''; patches = [ # https://github.com/php-gnupg/php-gnupg/issues/62 - ./missing-new-line-test.patch + (fetchpatch { + name = "fix-test-typos.patch"; + url = "https://github.com/php-gnupg/php-gnupg/commit/4b9160b94df1d831d7bcc4f980cb8969d9ab5c11.patch"; + hash = "sha256-fJ/H1tbwMuLUpdWe0+oPyzhBFAsjG2QzmZSiuIsMekY="; + }) + (fetchpatch { + name = "fix-clearsign-newline-test.patch"; + url = "https://github.com/php-gnupg/php-gnupg/commit/6eda368b55044343349a8e76f6beda3ad54660dc.patch"; + hash = "sha256-/c+cxfAj3Cg7m2+sFiHWQr4R9atPypQuAUVyAOI8ZeM="; + }) ]; doCheck = true; diff --git a/pkgs/development/php-packages/gnupg/missing-new-line-test.patch b/pkgs/development/php-packages/gnupg/missing-new-line-test.patch deleted file mode 100644 index 5a31f7c931d5..000000000000 --- a/pkgs/development/php-packages/gnupg/missing-new-line-test.patch +++ /dev/null @@ -1,28 +0,0 @@ -diff --git a/tests/gnupg_oo_sign_clear.phpt b/tests/gnupg_oo_sign_clear.phpt -index 4f9b79c..05fda25 100644 ---- a/tests/gnupg_oo_sign_clear.phpt -+++ b/tests/gnupg_oo_sign_clear.phpt -@@ -38,8 +38,7 @@ array(1) { - int(0) - } - } --string(8) "foo bar --" -+string(7) "foo bar" - --CLEAN-- -