Gnus development mailing list
 help / color / mirror / Atom feed
From: Daiki Ueno <ueno@unixuser.org>
Cc: ding@gnus.org
Subject: Re: EasyPG and attachment with ``.pgp'' extension
Date: Mon, 22 Jan 2007 10:23:15 +0900	[thread overview]
Message-ID: <9049cb44-9ae5-4f98-b191-b69b23e39587@well-done.deisui.org> (raw)
In-Reply-To: <7ivej0u3tp.fsf@lanthane.pps.jussieu.fr> (Juliusz Chroboczek's message of "Sun, 21 Jan 2007 10:28:02 +0100")

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

>>>>> In <7ivej0u3tp.fsf@lanthane.pps.jussieu.fr> 
>>>>>	Juliusz Chroboczek <jch@pps.jussieu.fr> wrote:
> I recently received an unencrypted e-mail with an encrypted attachment
> with was of MIME type ``application/octet-stream'' and an extension of
> ``.pgp''.  When I tried to save the attachment to disk, EasyPG asked
> me to select a destination key and insisted that I must encrypt it.  Again.

> This was worked around by saving the attachment to a different
> filename and then renaming it from the shell, but it's still mightily
> inconvenient.

It's not so easy to be solved because mm-save-part-to-file avoids only
re-compression, and there is no option to avoid re-encryption as well.

Preliminarily, I just installed the following change to the Gnus trunk.

2007-01-22  Daiki Ueno  <ueno@unixuser.org>

	* mm-decode.el (mm-save-part-to-file): Use `mm-write-region' instead of
	`write-region' to respect `mm-inhibit-file-name-handlers'.


[-- Attachment #2: mm-decode.el.diff --]
[-- Type: application/octet-stream, Size: 1268 bytes --]

Index: lisp/mm-decode.el
===================================================================
RCS file: /usr/local/cvsroot/gnus/lisp/mm-decode.el,v
retrieving revision 7.48
retrieving revision 7.49
diff -u -w -r7.48 -r7.49
--- lisp/mm-decode.el	1 Jan 2007 07:25:51 -0000	7.48
+++ lisp/mm-decode.el	22 Jan 2007 01:01:21 -0000	7.49
@@ -1210,17 +1210,13 @@
 (defun mm-save-part-to-file (handle file)
   (mm-with-unibyte-buffer
     (mm-insert-part handle)
-    (let ((coding-system-for-write 'binary)
-	  (current-file-modes (default-file-modes))
+    (let ((current-file-modes (default-file-modes)))
+      (set-default-file-modes mm-attachment-file-modes)
+      (unwind-protect
 	  ;; Don't re-compress .gz & al.  Arguably we should make
 	  ;; `file-name-handler-alist' nil, but that would chop
 	  ;; ange-ftp, which is reasonable to use here.
-	  (inhibit-file-name-operation 'write-region)
-	  (inhibit-file-name-handlers
-	   (cons 'jka-compr-handler inhibit-file-name-handlers)))
-      (set-default-file-modes mm-attachment-file-modes)
-      (unwind-protect
-	  (write-region (point-min) (point-max) file)
+	  (mm-write-region (point-min) (point-max) file nil nil nil 'binary t)
 	(set-default-file-modes current-file-modes)))))
 
 (defun mm-pipe-part (handle)

[-- Attachment #3: Type: text/plain, Size: 225 bytes --]


After this change, with the following setting, mm-save-part-to-file will
not attempt to re-encrypt.

(setq mm-inhibit-file-name-handlers
      (cons 'epa-file-handler mm-inhibit-file-name-handlers))

Regards,
-- 
Daiki Ueno

  reply	other threads:[~2007-01-22  1:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-21  9:28 Juliusz Chroboczek
2007-01-22  1:23 ` Daiki Ueno [this message]
2007-01-22  7:02   ` Daiki Ueno

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=9049cb44-9ae5-4f98-b191-b69b23e39587@well-done.deisui.org \
    --to=ueno@unixuser.org \
    --cc=ding@gnus.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).