From 3b4427522e01e8f537a7b3a922854167a70e1ecd Mon Sep 17 00:00:00 2001 From: Vivien Date: Sun, 7 Nov 2021 14:50:59 +0100 Subject: System: Fix run-with-store scope If run-with-store is only active for the computing of the gpg program, gpg may be garbage collected before we use it. --- vkraus/services/guix-wot.scm | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'vkraus') diff --git a/vkraus/services/guix-wot.scm b/vkraus/services/guix-wot.scm index ecc5093..5b53f9c 100644 --- a/vkraus/services/guix-wot.scm +++ b/vkraus/services/guix-wot.scm @@ -66,15 +66,18 @@ ;; openssh server to use. (match-lambda (($ users key-servers) - (apply invoke - `(,(run-with-store (open-connection) (package-file gnupg "/bin/gpg")) - ,@(apply append - (map - (lambda (key-server) - `("--keyserver" ,key-server)) - key-servers)) - "--recv-key" - ,@(map cdr users))) + (run-with-store + (open-connection) + (mlet %store-monad ((gpg (package-file gnupg "/bin/gpg"))) + (apply invoke + `(,gpg + ,@(apply append + (map + (lambda (key-server) + `("--keyserver" ,key-server)) + key-servers)) + "--recv-key" + ,@(map cdr users))))) (par-map (match-lambda ((user . fingerprint) @@ -84,9 +87,12 @@ (lambda (exn) (format (current-error-port) "Warning: no SSH key exported for ~a ~a: ~a.\n" user fingerprint exn)) (lambda () - (invoke (run-with-store (open-connection) (package-file gnupg "/bin/gpg")) - "-o" (port-filename port) - "--export-ssh-key" fingerprint)) + (run-with-store + (open-connection) + (mlet %store-monad ((gpg (package-file gnupg "/bin/gpg"))) + (invoke gpg + "-o" (port-filename port) + "--export-ssh-key" fingerprint)))) #:unwind? #t) (let ((interned (plain-file (format #f "user-key-file-~a" fingerprint) -- cgit v1.2.3