From d1357baf08ab3e2dac76ac396f743d8cf62c670b Mon Sep 17 00:00:00 2001 From: Arthur Gautier Date: Wed, 11 Jun 2025 09:40:28 -0700 Subject: [PATCH] swtpm: fixup tpm2_avoid_da_lockout test After libtpms got bumped to 0.10.1, `test_tpm2_avoid_da_lockout` would start breaking: ``` swtpm> FAIL: test_tpm2_avoid_da_lockout swtpm> ================================ swtpm> swtpm> Need to be root to run test with CUSE interface. swtpm> ==== Starting swtpm with interfaces socket+socket ==== swtpm> Error: Did not get expected result from TPM2_NV_Write swtpm> expected: 80 01 00 00 00 0a 00 00 09 22 swtpm> received: 80 01 00 00 00 0a 00 00 09 8e swtpm> _test_tpm2_avoid_da_lockout: line 17: 11905 Killed ${SWTPM_EXE} socket "$@" ${SWTPM_TEST_SECCOMP_OPT:+${SWTPM_TEST_SECCOMP_OPT}} --server "type=tcp,port=${SWTPM_SERVER_PORT}${swtpm_server_disconnect}" --ctrl "type=tcp,port=${SWTPM_CTRL_PORT}" swtpm> FAIL test_tpm2_avoid_da_lockout (exit status: 1) ``` This adopts the upstream patch fixing the test. --- pkgs/by-name/sw/swtpm/package.nix | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkgs/by-name/sw/swtpm/package.nix b/pkgs/by-name/sw/swtpm/package.nix index a109e5efaacd..ffb469c8dc52 100644 --- a/pkgs/by-name/sw/swtpm/package.nix +++ b/pkgs/by-name/sw/swtpm/package.nix @@ -2,6 +2,7 @@ lib, stdenv, fetchFromGitHub, + fetchpatch, autoreconfHook, pkg-config, libtasn1, @@ -35,6 +36,14 @@ stdenv.mkDerivation (finalAttrs: { hash = "sha256-N79vuI0FhawLyQtwVF6ABIvCmEaYefq/YkyrafUfUHE="; }; + patches = [ + (fetchpatch { + name = "retry-nwwrite.patch"; + url = "https://github.com/stefanberger/swtpm/commit/4da66c66f92438443e66b67555673c9cb898b0ae.patch"; + hash = "sha256-TTS+ViN4g6EfNLrhvGPobcSQEbr/mEl9ZLZTWdxbifs="; + }) + ]; + nativeBuildInputs = [ pkg-config unixtools.netstat