$ gpg --homedir /notexistent -dv <1.msg --override-session-key 7:D6E1027D58A0CB047C41EA881A137197 --status-fd 2 gpg: keyblock resource '/notexistent/pubring.kbx': No such file or directory [GNUPG:] ERROR add_keyblock_resource 33587281 gpg: public key is 7F3B7ED4319BCCA8 [GNUPG:] ENC_TO 7F3B7ED4319BCCA8 18 0 [GNUPG:] ERROR keydb_search 33554445 gpg: encrypted with ECDH key, ID 7F3B7ED4319BCCA8
Indeed, this makes gpg return 2. The reason is that the first error message uses log_error which sets a flag to have gpg return 2. Now, changing this to log_info may produce problems for applications which expect that gpg errors out for a bad homedir.