unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Albinus <michael.albinus@gmx.de>
To: Jens Lechtenboerger <jens.lechtenboerger@fsfe.org>
Cc: 20634@debbugs.gnu.org
Subject: bug#20634: 25.0.50; Conflict between Tramp and EasyPG
Date: Sun, 24 May 2015 18:24:04 +0200	[thread overview]
Message-ID: <87lhgevt97.fsf@gmx.de> (raw)
In-Reply-To: <87fv6n8ghx.fsf@informationelle-selbstbestimmung-im-internet.de> (Jens Lechtenboerger's message of "Sat, 23 May 2015 17:23:38 +0200")

Jens Lechtenboerger <jens.lechtenboerger@fsfe.org> writes:

> Hi there,

Hi Jens,

> I use EasyPG for transparent access of encrypted files with
> extension .gpg.  If I copy an encrypted file, say test.gpg, via ssh
> (Tramp) to a remote location, then I’m asked what public key to use
> for encryption (none for symmetric encryption), and the encrypted
> file is encrypted again, rendering it useless from within Emacs.
> (If I open the remote file via Tramp, the outer layer of encryption
> is removed, and I see the original encrypted file.)

Thanks for the report; I could reproduce the problem using your
recipe. Could you, please, check whether the following patch fixes the
problem?

--8<---------------cut here---------------start------------->8---
*** /home/albinus/src/tramp/lisp/tramp-sh.el.~master~	2015-05-24 18:17:53.333961247 +0200
--- /home/albinus/src/tramp/lisp/tramp-sh.el	2015-05-24 18:13:15.299684599 +0200
***************
*** 2122,2136 ****
  KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
    ;; We must disable multibyte, because binary data shall not be
    ;; converted.  We don't want the target file to be compressed, so we
!   ;; let-bind `jka-compr-inhibit' to t.
!   ;; We remove `tramp-file-name-handler' from
    ;; `inhibit-file-name-handlers'; otherwise the file name handler for
    ;; `insert-file-contents' might be deactivated in some corner cases.
    (let ((coding-system-for-read 'binary)
  	(coding-system-for-write 'binary)
  	(jka-compr-inhibit t)
  	(inhibit-file-name-handlers
! 	 (remq 'tramp-file-name-handler inhibit-file-name-handlers)))
      (with-temp-file newname
        (set-buffer-multibyte nil)
        (insert-file-contents-literally filename)))
--- 2122,2137 ----
  KEEP-DATE is non-nil if NEWNAME should have the same timestamp as FILENAME."
    ;; We must disable multibyte, because binary data shall not be
    ;; converted.  We don't want the target file to be compressed, so we
!   ;; let-bind `jka-compr-inhibit' to t.  `epa-file-handler' shall not
!   ;; be called either.  We remove `tramp-file-name-handler' from
    ;; `inhibit-file-name-handlers'; otherwise the file name handler for
    ;; `insert-file-contents' might be deactivated in some corner cases.
    (let ((coding-system-for-read 'binary)
  	(coding-system-for-write 'binary)
  	(jka-compr-inhibit t)
  	(inhibit-file-name-handlers
! 	 (cons epa-file-handler
! 	       . (remq 'tramp-file-name-handler inhibit-file-name-handlers))))
      (with-temp-file newname
        (set-buffer-multibyte nil)
        (insert-file-contents-literally filename)))
***************
*** 3205,3211 ****
  	 (if (fboundp 'find-buffer-file-type)
  	     (symbol-function 'find-buffer-file-type)
  	   nil))
! 	(inhibit-file-name-handlers '(jka-compr-handler image-file-handler))
  	(inhibit-file-name-operation 'insert-file-contents))
      (unwind-protect
  	(progn
--- 3206,3213 ----
  	 (if (fboundp 'find-buffer-file-type)
  	     (symbol-function 'find-buffer-file-type)
  	   nil))
! 	(inhibit-file-name-handlers
! 	 '(epa-file-handler image-file-handler jka-compr-handler))
  	(inhibit-file-name-operation 'insert-file-contents))
      (unwind-protect
  	(progn
--8<---------------cut here---------------end--------------->8---

> Note also that if I copy a plaintext file (test.txt) locally to one
> with gpg extension (test.gpg), it remains a plaintext file.  If I
> copy that to a remote location, it gets encrypted.  This may be a
> bug or a feature, but is certainly inconsistent behavior.

It is rather a feature (a copy operation shall not change the file
contents). The above patch shall fix this as well.

> Best wishes
> Jens

Best regards, Michael.





  reply	other threads:[~2015-05-24 16:24 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-23 15:23 bug#20634: 25.0.50; Conflict between Tramp and EasyPG Jens Lechtenboerger
2015-05-24 16:24 ` Michael Albinus [this message]
2015-05-25 10:47   ` Michael Albinus
2015-05-25 16:32     ` Jens Lechtenboerger
2015-05-25 18:35       ` Michael Albinus
     [not found]         ` <87k2vva0lw.fsf@informationelle-selbstbestimmung-im-internet.de>
2015-05-26 14:17           ` Michael Albinus
2015-05-26 14:31         ` Jens Lechtenboerger

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=87lhgevt97.fsf@gmx.de \
    --to=michael.albinus@gmx.de \
    --cc=20634@debbugs.gnu.org \
    --cc=jens.lechtenboerger@fsfe.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 public inbox

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

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 read-only IMAP folder(s) and NNTP newsgroup(s).