From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/75598 Path: news.gmane.org!not-for-mail From: Daiki Ueno Newsgroups: gmane.emacs.gnus.general Subject: Re: auth-source (.authinfo.gpg) stopped working? Date: Wed, 05 Jan 2011 11:51:49 +0900 Message-ID: References: <84ipyjkcch.fsf@davestoy.home> <87vd2f2w2f.fsf@lifelogs.com> <8462ufjjya.fsf@davestoy.home> <84tyhyhs1q.fsf@davestoy.home> <84k4im3yak.fsf@davestoy.home> <84bp3y3x1i.fsf@davestoy.home> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1294195996 9432 80.91.229.12 (5 Jan 2011 02:53:16 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 5 Jan 2011 02:53:16 +0000 (UTC) To: ding@gnus.org Original-X-From: ding-owner+M23949@lists.math.uh.edu Wed Jan 05 03:53:11 2011 Return-path: Envelope-to: ding-account@gmane.org Original-Received: from util0.math.uh.edu ([129.7.128.18]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PaJUs-0002Eq-DQ for ding-account@gmane.org; Wed, 05 Jan 2011 03:53:10 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.math.uh.edu) by util0.math.uh.edu with smtp (Exim 4.63) (envelope-from ) id 1PaJTt-0005mD-Ug; Tue, 04 Jan 2011 20:52:09 -0600 Original-Received: from mx2.math.uh.edu ([129.7.128.33]) by util0.math.uh.edu with esmtps (TLSv1:AES256-SHA:256) (Exim 4.63) (envelope-from ) id 1PaJTr-0005m0-5n for ding@lists.math.uh.edu; Tue, 04 Jan 2011 20:52:07 -0600 Original-Received: from quimby.gnus.org ([80.91.231.51]) by mx2.math.uh.edu with esmtp (Exim 4.72) (envelope-from ) id 1PaJTm-0002Uw-Ov for ding@lists.math.uh.edu; Tue, 04 Jan 2011 20:52:06 -0600 Original-Received: from ivory4.scn-net.ne.jp ([219.117.176.192]) by quimby.gnus.org with smtp (Exim 4.72) (envelope-from ) id 1PaJTl-0008Cc-7o for ding@gnus.org; Wed, 05 Jan 2011 03:52:01 +0100 Original-Received: from ([192.168.0.187]) (envelope sender: ) by ivory4.scn-net.ne.jp with Active!Hunter esmtp server; Wed, 5 Jan 2011 11:51:56 +0900 Original-Received: Received: from well-done.deisui.org (g187018.scn-net.ne.jp [202.83.187.18]) (authenticated) by blue17.scn-net.ne.jp (unknown) with ESMTP id p052ptRB013892 for ; Wed, 5 Jan 2011 11:51:56 +0900 In-Reply-To: (Daiki Ueno's message of "Tue, 04 Jan 2011 10:36:17 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) X-Spam-Score: -1.9 (-) List-ID: Precedence: bulk Xref: news.gmane.org gmane.emacs.gnus.general:75598 Archived-At: --=-=-= Daiki Ueno writes: > Presumably this might be the culprit. It copies the function > `netrc-store-data' from netrc.el and most likely the format is different > from the one used by netrc.el included in XEmacs packages. Sorry I was missing the point. Please ignore my guess the above. After debugging with XEmacs (I could reproduce the problem), now I suspect that the cause is elsewhere. Even with or without the above change, (netrc-parse "~/.authinfo.gpg") always returns nil except the first time, because the netrc-cache handling is buggy. netrc saves the content of the file in a form mangled with base64 and rot13. However, XEmacs does not have rot13-string and dgnushack.el defines rot13-string as a macro: (defmacro rot13-string (string) "Return ROT13 encryption of STRING." `(with-temp-buffer (insert ,string) (translate-region (point-min) (point-max) ,rot13-display-table) (buffer-string))) netrc-parse uses it as to save the contents: (setq netrc-cache ... (rot13-string (base64-encode-string (buffer-string)))) Guess what will happen. Since buffer-string is called from the buffer created by rot13-string, it will always return "". I'm attaching a patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-argument-passing-when-rot13-string-is-defined-as.patch >From 0e33d1b9c124bdc1f6fe4a186078318da887e386 Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Wed, 5 Jan 2011 11:47:59 +0900 Subject: [PATCH] Fix argument passing when rot13-string is defined as macro. --- lisp/ChangeLog | 5 +++++ lisp/netrc.el | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 586e706..a6a9d96 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2011-01-05 Daiki Ueno + + * netrc.el (netrc-parse): Take care of the arg of rot13-string in case + that it is defined as a macro. + 2011-01-03 Lars Magne Ingebrigtsen * flow-fill.el (fill-flowed-encode): Do encoding citation-aware. diff --git a/lisp/netrc.el b/lisp/netrc.el index 989470b..ab4c0d8 100644 --- a/lisp/netrc.el +++ b/lisp/netrc.el @@ -69,9 +69,11 @@ (insert-file-contents file) (when (string-match "\\.gpg\\'" file) (setq netrc-cache (cons (nth 5 (file-attributes file)) - (rot13-string - (base64-encode-string - (buffer-string))))))) + (buffer-string))) + ;; Store the contents of the file heavily encrypted in memory. + (setcdr netrc-cache (rot13-string + (base64-encode-string + (cdr netrc-cache)))))) (goto-char (point-min)) ;; Go through the file, line by line. (while (not (eobp)) -- 1.7.3.4 --=-=-= Regards, -- Daiki Ueno --=-=-=--