[PATCH] gpg: Show error when deleting keys without a key identifier

Ashish Gupta ashmew2 at gmail.com
Mon May 30 14:06:17 CEST 2016


-------------- next part --------------


On Sun, May 29, 2016 at 10:50 PM, Werner Koch <wk at gnupg.org> wrote:
> Hi!
>
> On Sun, 29 May 2016 13:57, ashmew2 at gmail.com said:
>
>> +  /* If no key was specified for deleting, show error message */
>> +  if ( !names )
>> +    {
>> +      log_error (_("No key was specified for deletion.\n"));
>
> This is an incompatible change which will break scripts relying on the
> existing behaviour.  At best a warning (using log_info) could be shown
> but I doubt that this is desirable.
>
>
> Salam-Shalom,
>
>    Werner
>
> --
> Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
>     /* EFH in Erkrath: https://alt-hochdahl.de/haus */
>

Hi!
Thanks for the response. I understand, and will be more careful in the future.

How about this?
--

[PATCH] Show warning when deleting keys without identifier

* Add a warning message to the output when the user does not supply a key
to be deleted with --delete-keys or --delete-secret-keys.
--

Signed-off-by: Ashish Gupta <ashmew2 at gmail d0t c0m>

---
 g10/delkey.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/g10/delkey.c b/g10/delkey.c
index 966c571..a8f3306 100644
--- a/g10/delkey.c
+++ b/g10/delkey.c
@@ -259,6 +259,10 @@ delete_keys (strlist_t names, int secret, int allow_both)
   /* Force allows us to delete a public key even if a secret key
      exists. */
 
+  /* If no key was specified for deleting, show info message */
+  if ( !names )
+    log_info (_("No key was specified for deletion.\n"));
+
   for ( ;names ; names=names->next )
     {
       err = do_delete_key (names->d, secret, force, &avail);
-- 
2.7.3

-------------- next part --------------
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAABCAAGBQJXTCxpAAoJEFzyLcYjLACbkGgIAJNP/p5yhLBPH9SGWzX+7AO8
vSUlIS7xoE9I/hrXxNxYedsfO8NYoGZ4+h+MsTSM47IOXd5KiuGPQij7u0JtHoTQ
m6371aH0GdVexcSt5z2VGtPKm8+QNN+XpHk48oT1NlXlFIZ4yCNZ739knEVd5/5p
Fop80HAqODsQWXGje1L8rSOyWe0nfS6BcAquExoWHb6SU0j+juiaEG4LHfont/1M
1YvRZb9JiPzAktBxBPYa4MktghM+rgDe+QAoAkHrcSyQdTEYcTMXJVfwsFcGhL1d
s4Bxbbm5abKpjuWjjjc5qU1Z+lDpToaVKZu/90xGHNVKgH0EnhS+PC6zSvWBbbE=
=MgNS
-----END PGP SIGNATURE-----


More information about the Gnupg-devel mailing list