all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Attila Lendvai <attila.lendvai@gmail.com>
Cc: 16029-done@debbugs.gnu.org
Subject: bug#16029: 24.3.50; epa-file.el: decrypted contents get inserted into the wrong buffer
Date: Mon, 02 Dec 2013 13:56:40 -0500	[thread overview]
Message-ID: <jwvsiubythe.fsf-monnier+emacsbugs@gnu.org> (raw)
In-Reply-To: <87zjojusmb.fsf@debian.lan> (Attila Lendvai's message of "Mon, 02 Dec 2013 22:26:04 +0600")

> it's a race condition while opening a file using epa-file.el to decrypt
> its contents on the fly, and something else closing the buffer.

Indeed, epg-decrypt-file runs filters and timers, so "anything can
happen".  I installed the patch below to try and address this problem,


        Stefan


=== modified file 'lisp/epa-file.el'
--- lisp/epa-file.el	2013-10-28 08:04:48 +0000
+++ lisp/epa-file.el	2013-12-02 18:51:23 +0000
@@ -132,6 +132,7 @@
 	    (error)))
 	 (local-file (or local-copy file))
 	 (context (epg-make-context))
+         (buf (current-buffer))
 	 string length entry)
     (if visit
 	(setq buffer-file-name file))
@@ -157,9 +158,10 @@
 			 nil t))
 	     (signal 'file-error
 		     (cons "Opening input file" (cdr error)))))
-	  (make-local-variable 'epa-file-encrypt-to)
-	  (setq epa-file-encrypt-to
-		(mapcar #'car (epg-context-result-for context 'encrypted-to)))
+          (set-buffer buf) ;In case timer/filter changed/killed it (bug#16029)!
+	  (setq-local epa-file-encrypt-to
+                      (mapcar #'car (epg-context-result-for
+                                     context 'encrypted-to)))
 	  (if (or beg end)
 	      (setq string (substring string (or beg 0) end)))
 	  (save-excursion






      reply	other threads:[~2013-12-02 18:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-12-02 16:26 bug#16029: 24.3.50; epa-file.el: decrypted contents get inserted into the wrong buffer Attila Lendvai
2013-12-02 18:56 ` Stefan Monnier [this message]

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=jwvsiubythe.fsf-monnier+emacsbugs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=16029-done@debbugs.gnu.org \
    --cc=attila.lendvai@gmail.com \
    /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.