Subject: bug#2412: spurious "Sign failed" errors

From: Sven Joachim <[email-masked]>
Date: Sun, 03 May 2009 12:33:30 +0200

On 2009-05-03 07:43 +0200, Daiki Ueno wrote:

> Sven Joachim <[email-masked]> writes:
>
>>>> could you please try (setq epg-debug t) and show me the contents of
>>>> " *epg-debug*" buffer next time you see the error?
>
>> Looks innocent enough to me:
>
>> | [GNUPG:] SIG_CREATED D 17 2 01 1239906974 9AACBC0C69283380715D3788ECB679C787E9AABE
>> | [GNUPG:] SIG_CREATED D 17 2 01 1239906984 9AACBC0C69283380715D3788ECB679C787E9AABE
>
> Thanks.  It looks innocent for me too, but now I can suspect a timing
> problem.  Could you please try the patch attached below?
>
>
> diff --git a/lisp/epg.el b/lisp/epg.el
> index e96258f..3c80ef9 100644
> --- a/lisp/epg.el
> +++ b/lisp/epg.el
> @@ -1175,7 +1175,8 @@ This function is for internal use only."
>  (defun epg-wait-for-completion (context)
>    "Wait until the `epg-gpg-program' process completes."
>    (while (eq (process-status (epg-context-process context)) 'run)
> -    (accept-process-output (epg-context-process context) 1)))
> +    (accept-process-output (epg-context-process context) 1))
> +  (sleep-for 0.1))
>  
>  (defun epg-reset (context)
>    "Reset the CONTEXT."

That seems to do the trick.  At least, I had no problem in ~15 attempts
to preview/send signed messages, whereas without your patch the "Sign
failed" error would happen about every second time.

Cheers,
       Sven