From fbe318475236166b54e19d228bf9b24e442e0fa5 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Wed, 18 Mar 2020 15:26:43 +0100 Subject: [PATCH] gpg: Print a hint for --batch mode and --delete-secret-key. * g10/delkey.c: Include shareddefs.h. (delete_keys): Print a hint. -- The option --yes has some side-effects so it is not desirable to use it automatically. The code in master (2.3) has special treatment of confirm messages and thus this patch is only for 2.2. GnuPG-bug-id: 4667 Signed-off-by: Werner Koch --- g10/delkey.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/g10/delkey.c b/g10/delkey.c index 6116d7406..13dbcf062 100644 --- a/g10/delkey.c +++ b/g10/delkey.c @@ -38,6 +38,7 @@ #include "filter.h" #include "../common/ttyio.h" #include "../common/i18n.h" +#include "../common/shareddefs.h" #include "call-agent.h" @@ -368,6 +369,11 @@ delete_keys (ctrl_t ctrl, strlist_t names, int secret, int allow_both) { log_error ("%s: delete key failed: %s\n", names->d, gpg_strerror (err)); + if (gpg_err_code (err) == GPG_ERR_NO_PIN_ENTRY + && opt.batch && secret + && opt.pinentry_mode == PINENTRY_MODE_LOOPBACK) + log_info ("(try option \"--yes\" to delete anyway)\n"); + return err; } }