Subject: Re: [PATCH 2/5] lib-gpg: allow tests with the GPGSM prereq first

From: Collin Funk <[email-masked]>
Date: Wed, 08 Oct 2025 18:29:07 -0700

Christian Couder <[email-masked]> writes:

>> Okay. I wonder why we even have to create the directory manually. We
>> don't do it in the GPGSM prereq either, as gpgsm seems to handle this
>> for us.
>
> Yeah, the GPGSSH prereq does `mkdir -p "$GNUPGHOME"`, but not the GPGSM prereq.
>
>> Doesn't `gpg --homedir ... --import` create the home directory
>> in a similar way?
>
> I am not sure. It might depend on the gpg version. Or maybe gpgsm
>  does it but not gpg. I will check.

If $GNUPGHOME or --homedir is the default (usually ~/.gnupg) gets
created by 'gpg' and 'gpgsm':

    $ ls ~/.gnupg
    ls: cannot access '/root/.gnupg': No such file or directory
    $ gpgsm
    gpgsm: directory '/root/.gnupg' created
    gpgsm: invalid command (there is no implicit command)
    $ rm -rf ~/.gnupg && gpg
    gpg: directory '/root/.gnupg' created
    [...]

If it is not the default then it will not be created:

    $ GNUPGHOME=$HOME/test gpgsm
    gpgsm: keyblock resource '/root/test/pubring.kbx': No such file or directory
    $ GNUPGHOME=$HOME/test gpg
    gpg: keyblock resource '/root/test/pubring.kbx': No such file or directory

Collin