[PATCH consfigurator v3 2/8] refactor use of gnupg in consfigurator.data.pgp

Sean Whitton spwhitton at spwhitton.name
Sun Mar 20 17:08:14 GMT 2022


Hello,

On Sun 13 Mar 2022 at 11:40am -03, David Bremner wrote:

> diff --git a/src/data/util.lisp b/src/data/util.lisp
> index bb66c9b..baf1dde 100644
> --- a/src/data/util.lisp
> +++ b/src/data/util.lisp
> +
> +(defun gpg (args &key input output)
> +  "run gnupg, taking homedir from *DATA-SOURCE-GNUPGHOME* if set. Return value
> +is output from gnupg, as a string, INPUT and OUTPUT have the same meaning as
> +for RUN-PROGRAM."
> +  (run-program
> +   `("gpg"
> +     ,@(and *data-source-gnupghome*
> +            (list "--homedir" (namestring *data-source-gnupghome*)))
> +     , at args)
> +   :input  input
> +   :output (or output :string)))

Is this last line because the parameter defaults to :string?  If not,
then OUTPUT wouldn't have the same meaning as for RUN-PROGRAM.  If so,
please add a comment saying that, or alternatively -- what I think I'd
do -- use -supplied-p parameters to avoid passing the :output argument
at all in the case that the user does not supply one.

> +(defun gpg-file-as-string (location)
> +  "Decrypt the contents of a gpg encrypted file at LOCATION, return as a
> +string."
> +  (handler-case
> +      (gpg (list "--decrypt" (unix-namestring location)))
> +    (subprocess-error (error)
> +      (missing-data-source "While attempt to decrypt, gpg exited with ~A"
> +			   (uiop:subprocess-error-code error)))))

Might be worth including LOCATION in the error message here.

-- 
Sean Whitton



More information about the sgo-software-discuss mailing list