[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#20634: 25.0.50; Conflict between Tramp and EasyPG
From: |
Michael Albinus |
Subject: |
bug#20634: 25.0.50; Conflict between Tramp and EasyPG |
Date: |
Sun, 24 May 2015 18:24:04 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) |
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.