all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "ken manheimer" <ken.manheimer@gmail.com>
To: emacs-devel <emacs-devel@gnu.org>, emacs-pretest-bug@gnu.org
Subject: pgg-gpg.el - pgg-gpg-process-region timing problem
Date: Sun, 22 Jun 2008 13:37:11 -0400	[thread overview]
Message-ID: <2cd46e7f0806221037h6d16839bp567eb5b901313375@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 3349 bytes --]

allout encryption, which depends on pgg.el &c, has been failing due to
a weird timing problem i've narrowed down to the
pgg-gpg-process-region function.  this is in emacs 23.0.60 built from
a CVS HEAD checkout of an hour or so ago, and some earlier 23.0.60
versions.  i've reproduced the problem using emacs -q and regularly
launched emacs, etc.

the problem is that pgg-gpg-process-region often returns a nil status
despite successful decryption, unless a delay (eg, (sleep-for .3) is
inserted between process start and later interaction with the process.
 with the delay, the status is something like 207 or 208, while
without it the status is nil - yet, on examination the content is
sucessfully decrypted.

the size of the delay needs to be increased when the machine is
heavily loaded, and can be reduced (on my thinkpad t43 2 GHz laptop,
3Gb ram, running kubuntu 8.0.4 +) to no lower than (sleep-for .2).
rarely, the proper status is returned without the delay, depending on
the machine load and other things i can't identify.  considering the
real-time sensitivity of the problem, your mileage will almost
certainly vary!

i originally thought the problem might be in gpg, but now figure it
resides either in the emacs process mechanism, pgg's use of that, or
somewhere in the combination of emacs and pgg.

i've created a simple .el script, pggprob.el, with minimal code and
data to produce the problem, and a patch, pggprob-patch.txt, with a
single-line modification to pgg-gpg-process-region to work around the
problem.  both are attached.  since the workaround is merely a timing
delay, it's clearly not a fix!  i'm hoping this is enough to enable
others to reproduce the problem, and investigate...
--
ken
http://myriadicity.net

If Emacs crashed, and you have the Emacs process in the gdb debugger,
please include the output from the following gdb commands:
    `bt full' and `xbacktrace'.
If you would like to further debug the crash, please read the file
/home/klm/src/emacs-HEAD/etc/DEBUG for instructions.

In GNU Emacs 23.0.60.1 (i686-pc-linux-gnu, GTK+ Version 2.12.9)
 of 2008-06-22 on twist
Windowing system distributor `The X.Org Foundation', version 11.0.10400090
Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: en_US.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default-enable-multibyte-characters: t

Major mode: Emacs-Lisp

Minor modes in effect:
  tooltip-mode: t
  tool-bar-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  global-auto-composition-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
C-x C-f <M-backspace> <M-backspace> <M-backspace> l
i b / e m a <tab> a l l <tab> s c r <tab> p g g p <tab>
<return> M-x e v a l - c u r <tab> <return> M-. C-g
M-> C-x C-e M-x e m a c s <M-backspace> r e p o r t
- e m <tab> <return>

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Source file `/home/klm/src/emacs-HEAD/lisp/pgg-gpg.el' newer than
byte-compiled file
Quit
Mark set
nil

[-- Attachment #2: pggprob.el --]
[-- Type: application/octet-stream, Size: 671 bytes --]

;; demonstrate timing problem in pgg-gpg-process-region

(setq passphrase "a"
      verifier "-----BEGIN PGP MESSAGE-----
Version: GnuPG v1.4.6 (GNU/Linux)

jA0EAwMCo72fNGB1rNxgySv+rxdkPv46nVxQ5fg4yT78ldgVcDseD7Mre4Fhjifn
VTA1/PdmetVfFb9+
=MXF6
-----END PGP MESSAGE-----"
      count 0)

(defun decrypt (passphrase text)
  (with-current-buffer (get-buffer-create "*pgg-test*")
    (erase-buffer)
    (insert text)
    (pgg-decrypt nil nil passphrase)))

;; the following yields nil w/out the patched delay, 208 with it.
;; examination of the actual results buffer shows that the verifier is
;; successfully decrypted in both cases, however.
(decrypt passphrase verifier)

[-- Attachment #3: pgg-patch.txt --]
[-- Type: text/plain, Size: 409 bytes --]

--- pgg-gpg.el.~1.27.~	2008-05-06 03:57:46.000000000 -0400
+++ pgg-gpg.el	2008-06-22 13:24:14.000000000 -0400
@@ -86,6 +86,7 @@
 	    (setq process
 		  (apply #'start-process "*GnuPG*" errors-buffer
 			 program args)))
+          (sleep-for .3)                ; klm: timing delay
 	  (set-process-sentinel process #'ignore)
 	  (when passphrase
 	    (setq passphrase-with-newline (concat passphrase "\n"))

             reply	other threads:[~2008-06-22 17:37 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <873aln2q1d.fsf@stupidchicken.com>
2008-06-22 17:37 ` ken manheimer [this message]
2008-06-23  8:17   ` bug#470: pgg-gpg.el - pgg-gpg-process-region timing problem Thien-Thi Nguyen
2008-06-23  8:17   ` Thien-Thi Nguyen
2008-06-23  8:43     ` bug#469: " Thien-Thi Nguyen
2008-06-23  8:43     ` Thien-Thi Nguyen
2008-06-23 13:17       ` bug#471: " Thien-Thi Nguyen
2008-06-23 13:17       ` Thien-Thi Nguyen
2008-06-23 17:44         ` bug#472: " ken manheimer
2008-06-23 17:44         ` ken manheimer
2008-06-24 10:42           ` Thien-Thi Nguyen
2008-06-24 12:30             ` bug#476: " Stefan Monnier
2008-06-24 12:30             ` Stefan Monnier
2008-08-02 19:15               ` bug#476: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System
2008-08-02 19:15             ` bug#474: " Emacs bug Tracking System
2008-06-24 10:42           ` bug#474: pgg-gpg.el - pgg-gpg-process-region timing problem Thien-Thi Nguyen
2008-08-02 19:15           ` bug#472: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System
2008-06-24  1:59         ` pgg-gpg.el - pgg-gpg-process-region timing problem Daiki Ueno
2008-06-24  9:09           ` Thien-Thi Nguyen
2008-06-25 11:27             ` Daiki Ueno
2008-08-02 19:15         ` bug#471: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System
2008-08-02 19:15       ` bug#469: " Emacs bug Tracking System
2008-08-02 19:15     ` bug#470: " Emacs bug Tracking System
2008-06-26 16:16   ` pgg-gpg.el - pgg-gpg-process-region timing problem ken manheimer
2008-06-26 16:32     ` bug#487: " Chong Yidong
2008-06-26 16:32     ` Chong Yidong
2008-06-27 14:01       ` ken manheimer
2008-06-27 14:24         ` Miles Bader
2008-06-27 14:39           ` ken manheimer
2008-06-27 16:21             ` Stefan Monnier
2008-06-27 17:33         ` ken manheimer
2008-08-02 19:15       ` bug#487: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System
2008-08-02 19:15     ` bug#486: " Emacs bug Tracking System
2008-06-26 16:16   ` bug#486: pgg-gpg.el - pgg-gpg-process-region timing problem ken manheimer
2008-08-02 19:15   ` bug#465: marked as done (pgg-gpg.el - pgg-gpg-process-region timing problem) Emacs bug Tracking System

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2cd46e7f0806221037h6d16839bp567eb5b901313375@mail.gmail.com \
    --to=ken.manheimer@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=emacs-pretest-bug@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.