Page MenuHome GnuPG

No error message if PIN wrong on keytocard
Open, NormalPublic


While testing the fix for T6378 I noticed that keytocard does not give an error message when giving the wrong PIN.
The error message "wrong PIN" is only given in the debug output.

This should at least be displayed on the command line, too. Better would be a new PIN entry window popping up and complaining.



Related Objects

Event Timeline

In Kleopatra an error window comes up in this case:

Kopieren des Schlüssels auf Karte fehlgeschlagen: 
Falsche PIN

What it does (in g10/card-util.c:card_store_subkey) is:

if (rc)
  log_error (_("KEYTOCARD failed: %s\n"), gpg_strerror (rc));

When a user specifies log output to a file, it goes to there.

Ok, so this is not an issue for a standard user. Still I think "wrong PIN" should be given on the command line, too, and not only in the debugfile output.

I understand the issue that you don't see an important message of the error.
Possibly, for this particular case, it would be changed to tty_printf instead.

But... it's not only this particular case of KEYTOCARD.
It's common pattern in our code base to use log_error. Developers assume that it will be seen by a user.

Shall we change log_* functions also emit message to console, when file/socket is specified?

werner triaged this task as Normal priority.Apr 27 2023, 4:55 PM
werner added a subscriber: werner.

!ebo: Did you set a log-file into gpg.conf or common.conf ?