Page MenuHome GnuPG

Kleopatra: Reports success when gpgtar is kill with SIGTERM or SIGKILL while folder is encrypted
Open, NormalPublic

Description

Reproduce:

  • Start the encryption of a folder with Kleopatra
  • While the encryption is in progress, kill the gpgtar process (e.g. killall gpgtar).

Expected result:
Kleopatra reports an error.

Observed result:
Kleopatra reports success.

Additional info:
If gpgtar is killed with SIGTERM, then the "audit log" ends with

gpgtar: signal Terminated caught ... exiting

It seems gpgtar happily exits with 0 and forgets to remove the partially written encrypted archive. The easiest solution would be to exit with a non-zero error code. Then gpgme and Kleopatra notice the error and the latter can take care of removing the left-over file.

Or, maybe the problem is that gpgme doesn't notice that gpgtar was killed. We may need an explicit "success" status, so that it's absence signals an error to gpgme.

Event Timeline

ikloecker renamed this task from Kleopatra: Reports success when gpgtar is kill with SIGTERM while folder is encrypted to Kleopatra: Reports success when gpgtar is kill with SIGTERM or SIGKILL while folder is encrypted.Jun 22 2023, 4:29 PM
ikloecker updated the task description. (Show Details)
ikloecker added a project: gpgme.
werner triaged this task as Normal priority.Jun 22 2023, 4:30 PM
werner added a subscriber: werner.

Due to the double fork in gpgme we won't get the exit code which gpgtar emits. Possible actions in a signal handler are also limited; in particular we can't use stdio or estream. The only option to print a status line would we by using write directly. However, this might mess with the libassuan buffering. Thus, it is not a good idea to pkill gpgtar. Same is true for gpg and gpgsm.

Kleopatra could wait for a success status (not sure whether we emit it)

Yes, gpgtar emits a SUCCESS status. gpgme should probably check for this.

Interestingly, if one kills gpgtar, then gpgme receives an "END_ENCRYPTION" (emitted by gpg?) after gpgtar wrote "gpgtar: signal Terminated caught ... exiting".