From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Attila Lendvai Newsgroups: gmane.emacs.bugs Subject: bug#16029: 24.3.50; epa-file.el: decrypted contents get inserted into the wrong buffer Date: Mon, 02 Dec 2013 22:26:04 +0600 Message-ID: <87zjojusmb.fsf@debian.lan> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1386003131 16539 80.91.229.3 (2 Dec 2013 16:52:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 2 Dec 2013 16:52:11 +0000 (UTC) To: 16029@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 02 17:52:17 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VnWjI-0004Qe-Qv for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Dec 2013 17:52:17 +0100 Original-Received: from localhost ([::1]:37733 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnWjI-0008NK-Di for geb-bug-gnu-emacs@m.gmane.org; Mon, 02 Dec 2013 11:52:16 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41313) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnWjA-0008N6-Hd for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2013 11:52:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnWj4-0005hd-QU for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2013 11:52:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:40881) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnWj4-0005gr-N7 for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2013 11:52:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VnWj4-0004Ra-76 for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2013 11:52:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 02 Dec 2013 16:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 16029 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138600308017010 (code B ref -1); Mon, 02 Dec 2013 16:52:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 2 Dec 2013 16:51:20 +0000 Original-Received: from localhost ([127.0.0.1]:54898 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VnWiM-0004QG-Rz for submit@debbugs.gnu.org; Mon, 02 Dec 2013 11:51:20 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33594) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VnWKj-0003oE-Hs for submit@debbugs.gnu.org; Mon, 02 Dec 2013 11:26:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnWKZ-0005x9-Ca for submit@debbugs.gnu.org; Mon, 02 Dec 2013 11:26:48 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:59130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnWKZ-0005x2-96 for submit@debbugs.gnu.org; Mon, 02 Dec 2013 11:26:43 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:35276) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnWKU-00057h-0H for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2013 11:26:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VnWKO-0005ur-6d for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2013 11:26:37 -0500 Original-Received: from mail-la0-x230.google.com ([2a00:1450:4010:c03::230]:38973) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VnWKN-0005tt-5H for bug-gnu-emacs@gnu.org; Mon, 02 Dec 2013 11:26:32 -0500 Original-Received: by mail-la0-f48.google.com with SMTP id n7so8370026lam.35 for ; Mon, 02 Dec 2013 08:26:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:mime-version:content-type :content-transfer-encoding; bh=4urhdhBNoDJzj+wjUnG9PVFg6xanC3JiPRnhOe4fDZ8=; b=iAU3McCuX7g9/TB3YNI8AzLfuZ6UIz1Uv1AswSeGSKOI9M5Son4yLNqIeiJYROafG4 3JPJvfmAEKPxBtTeus1HgTggeOLdQrjyKzyxs69mmfD1j7WDe28aEfMkcMLuQDWbNJx2 XvXmiCvV6rsSdam3EgIhJAmEv++W7bYv9sjMYxdtq/gBHuVdzM36J64SRT6FgnqOcdqG O81e+jLAVMPq5RmwUpBQly6H3lob658OSnjplJehabk+SZvOg0dfKY3DaG5rt4JB+3yr 2bFIzt8Th7kNZmZwgA+yH0G6eO5G1EvE2qAywXSuGH0ZBrDZ2k0fiQdF3uhn2GpTGSnV 9lOA== X-Received: by 10.112.219.99 with SMTP id pn3mr1346930lbc.24.1386001589293; Mon, 02 Dec 2013 08:26:29 -0800 (PST) Original-Received: from lelap ([5.251.242.95]) by mx.google.com with ESMTPSA id m5sm81056817laj.4.2013.12.02.08.26.26 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Mon, 02 Dec 2013 08:26:27 -0800 (PST) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Mailman-Approved-At: Mon, 02 Dec 2013 11:51:17 -0500 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:81261 Archived-At: hi, 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. i have a timed function that auto-closes *.gpg buffers after a given time of inactivity: http://dwim.hu/darcsweb/darcsweb.cgi?r=3DHEAD%20hu.dwim.environment;a=3Dhea= dblob;f=3D/user/attila.lendvai/init.el#l72 the following simplified version can be used to reproduce the issue: (defun %kill-gpg-buffers () ;; automatically delete *.gpg buffers (dolist (buffer (copy-list (buffer-list))) (with-current-buffer buffer (when (and (string-match ".*\.gpg$" (buffer-name)) ;; a sloppy workaround: (> (buffer-size) 0) ) (message "Auto-killing .gpg buffer '%s'" (buffer-name buffer)) (kill-buffer buffer))))) (run-with-timer 0.1 0.1 '%kill-gpg-buffers) ;; (cancel-function-timers '%kill-gpg-buffers) note that gpg-agent can introduce a long delay when asking the user for the key password, which significantly raises the probability of triggering this (i managed to save decrypted content into files where i shouldn't have). a possible fix is to add a check to the right place that ensures that the current-buffer has not changed. i've experimented with this and that in epa-file-insert-file-contents, but my emacs background knowledge is too limited to efficiently deal with this security hole. if it'll be rejected as a wontfix, then please advise how to implement the autoclosing feature. thank you for your time, --=20 =E2=80=A2 attila lendvai =E2=80=A2 PGP: 963F 5D5F 45C7 DFCD 0A39 -- =E2=80=9COnce the fabric of a just society is undone, it takes generations = to weave it back together.=E2=80=9D =E2=80=94 Deepak Chopra In GNU Emacs 24.3.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.4.2) of 2013-04-20 on dex, modified by Debian (emacs-snapshot package, version 2:20130420-1) Windowing system distributor `The X.Org Foundation', version 11.0.11204000 System Description: Debian GNU/Linux 7.2 (wheezy) Configured using: `configure --build x86_64-linux-gnu --host x86_64-linux-gnu --prefix=3D/usr --sharedstatedir=3D/var/lib --libexecdir=3D/usr/lib --localstatedir=3D/var --infodir=3D/usr/share/info --mandir=3D/usr/share/m= an --with-pop=3Dyes --enable-locallisppath=3D/etc/emacs-snapshot:/etc/emacs:/usr/local/share/e= macs/24.3.50/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/24= .3.50/site-lisp:/usr/share/emacs/site-lisp --without-compress-info --with-crt-dir=3D/usr/lib/x86_64-linux-gnu/ --with-x=3Dyes --with-x-toolkit=3Dgtk3 --with-imagemagick=3Dyes CFLAGS=3D'-DDEBIAN -DSITELOAD_PURESIZE_EXTRA=3D5000 -g -O2' CPPFLAGS=3D'-D_FORTIFY_SOURCE=3D2' LDFLAGS=3D'-g -Wl,--as-needed -znocombreloc'' Important settings: value of $LANG: en_US.utf8 locale-coding-system: utf-8-unix default enable-multibyte-characters: t Major mode: Lisp Minor modes in effect: eldoc-mode: t nxhtml-menu-mode: t nxhtml-tag-do-also: t popcmp-group-alternatives: t popcmp-short-help-beside-alts: t mlinks-active-links: t rngalt-minimal-validation-header: t rngalt-display-validation-header: t global-edit-server-edit-mode: t delete-selection-mode: t ido-everywhere: t show-paren-mode: t slime-mode: t global-whitespace-mode: t shell-dirtrack-mode: t tooltip-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: =20 C-M-. =20 C-q =20 =20 M-k =20 =20 C-, C-M-/ C-. =20 C-x C-s C-M-b C-h C-x C-s =20 C-f =20 n o a c c o u =20 =20 =20 C-M-b =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 =20 ; ; SPC t h i =20 M-x r e p o r t - e m a c s Recent messages: Mark set Saving file /home/alendvai/.emacs.d/init.el... Wrote /home/alendvai/.emacs.d/init.el Decrypting /home/alendvai/notes/accounts.txt.gpg...done Auto-killing .gpg buffer 'accounts.txt.gpg' scroll-down-command: Beginning of buffer [17 times] Auto-saving...done call-interactively: Text is read-only delete-backward-char: Text is read-only call-interactively: End of buffer [12 times] Load-path shadows: /home/alendvai/workspace/hu.dwim.environment/emacs/htmlize hides /usr/share= /emacs-snapshot/site-lisp/emacs-goodies-el/htmlize /usr/share/emacs/24.3.50/site-lisp/debian-startup hides /usr/share/emacs/si= te-lisp/debian-startup /usr/share/emacs/24.3.50/site-lisp/cmake-data/cmake-mode hides /usr/share/e= macs/site-lisp/cmake-mode /home/alendvai/workspace/hu.dwim.environment/emacs/nxhtml/tests/ert hides /= usr/share/emacs/24.3.50/lisp/emacs-lisp/ert Features: (shadow sort mail-extr emacsbug cc-langs cc-mode-expansions cc-mode cc-fonts cc-guess cc-menus cc-styles cc-align dired-aux conf-mode eldoc edit-server-htmlize etags css-mode-expansions css-mode nxml-uchnm rng-xsd xsd-regexp rng-cmpct mule-util arc-mode archive-mode tramp-cache misearch multi-isearch debug nxhtml-autostart nxhtml-autoload moz cc-cmds majmodpri nxhtml-menu udev-rinari udev-ecb udev flymake-js flymake css-color nxhtml-mode html-quote tidy-xhtml ediff-merg ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff html-imenu imenu loadhist popcmp xhtml-help mlinks html-toc xml fupd html-pagetoc foldit appmenu-fold appmenu mumamo sgml-mode rngalt desktop cc-engine cc-vars cc-defs help-mode flyspell ispell fold-dwim hideshow html-upl html-site ourcomments-util uniquify recentf tree-widget the-org-mode-expansions org ob-tangle ob-ref ob-lob ob-table org-footnote org-src ob-comint ob-keys org-pcomplete org-list org-faces org-entities noutline outline org-version ob-emacs-lisp ob org-compat org-macs ob-eval org-loaddefs find-func cal-menu calendar cal-loaddefs bookmark apropos grep ffip compile gimpedit web-vcs rx url-http tls url url-proxy url-privacy url-expand url-methods url-history url-auth url-cookie url-domsuf url-util url-parse url-gw url-vars cus-edit web-autoload nxhtml-base lua-mode epa-file mu4e mu4e-speedbar speedbar sb-image ezimage dframe mu4e-main mu4e-view epa epg mu4e-headers mu4e-compose mu4e-draft mu4e-actions rfc2368 smtpmail sendmail mu4e-mark mu4e-message html2text mu4e-proc mu4e-utils doc-view jka-compr image-mode mu4e-lists mu4e-about mu4e-vars hl-line mu4e-meta expand-region text-mode-expansions nxml-mode-expansions html-mode-expansions er-basic-expansions expand-region-custom expand-region-core edit-server dwim-key-bindings dwim-init delsel slime-sprof slime-tramp slime-fancy slime-fontifying-fu slime-package-fu slime-scratch slime-fuzzy slime-fancy-trace slime-fancy-inspector slime-presentations slime-c-p-c slime-editing-commands slime-autodoc slime-parse slime-sbcl-exts slime-references slime-asdf slime-repl elp ido paren cus-start cus-load smooth-scrolling warnings scheme slime hyperspec thingatpt browse-url saveplace findr swbuff hu.dwim.logger hu.dwim.syntax-sugar hu.dwim.quasi-quote paredit edmacro kmacro hu.dwim.def goto-last-change whitespace rng-nxml rng-valid rng-loc rng-uri rng-parse nxml-parse rng-match rng-dt rng-util rng-pttrn nxml-ns nxml-mode nxml-outln nxml-rap nxml-util nxml-glyph nxml-enc xmltok tramp tramp-compat auth-source eieio byte-opt bytecomp byte-compile cconv tramp-loaddefs trampver shell pcomplete advice dired ielm pp comint ansi-color ring redo darcsum gnus-fun gnus-art mm-uu mml2015 epg-config mm-view mml-smime smime password-cache dig mailcap gnus-sum nnoo gnus-group gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range message format-spec rfc822 mml mml-sec mm-decode mm-bodies mm-encode mail-parse rfc2231 rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus gnus-ems nnheader gnus-util mail-utils mm-util mail-prsvr wid-edit easymenu derived add-log dwim-util help-fns cl-macs gv cl nadvice cl-lib magit-install emacs-goodies-el emacs-goodies-custom emacs-goodies-loaddefs easy-mmode time-date tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment lisp-mode register page menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock syntax facemenu font-core frame cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese case-table epa-hook jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces cus-face macroexp files text-properties overlay sha1 md5 base64 format env code-pages mule custom widget hashtable-print-readable backquote make-network-process dbusbind inotify dynamic-setting system-font-setting font-render-setting move-toolbar gtk x-toolkit x multi-tty emacs) <#secure method=3Dpgpmime mode=3Dsign>