[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: TRAMP copies binary files incorrectly
From: |
Chris Moore |
Subject: |
Re: TRAMP copies binary files incorrectly |
Date: |
Thu, 11 Jan 2007 01:23:30 +0100 |
User-agent: |
Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) |
Eli Zaretskii <address@hidden> writes:
> I just tried this, and I cannot reproduce the problem with the
> current CVS: I get an exact replica of the original file on my local
> machine.
I found what was causing the problem:
I didn't have uudecode installed on the local machine, so TRAMP was
using Emacs' Lisp version of uudecode, and using Emacs' write-region
to save the results to a file.
tramp.el is careful to bind coding-system-for-write to 'binary when
writing the region:
(let ((coding-system-for-write 'binary))
(funcall loc-dec (point-min) (point-max))
(write-region (point-min) (point-max) tmpfil))
but unfortunately that's not enough to stop write-region playing with
multi-byte characters - and that's probably the real bug.
The " *tramp tmp*" buffer has coding-system-for-write set to 'binary,
but also has enable-multibyte-characters set to t. write-region uses
fileio.c's e_write(), and that does the following, copying the
buffer's value of enable-multibyte-characters into the coding system,
before using it to write the region:
coding->src_multibyte
= !NILP (current_buffer->enable_multibyte_characters);
My question is: should having the coding-system-for-write set to
'binary be enough to stop any multi-byte processing being done on
write, regardless of the value of enable-multibyte-characters? And if
so, shouldn't we tell e_write() about it?
This patch demonstrates that it is enable-multibyte-characters which
causes the problem, but I suspect that the bug really needs fixing in
the C code:
--- lisp/net/tramp.el 2007-01-11 01:19:46.000000000 +0100
+++ lisp/net/new/tramp.el 2007-01-11 01:18:59.000000000 +0100
@@ -3827,6 +3827,7 @@
;; line from the output here. Go to point-max,
;; search backward for tramp_exit_status, delete
;; between point and point-max if found.
+ (set-buffer-multibyte nil)
(let ((coding-system-for-write 'binary))
(funcall loc-dec (point-min) (point-max))
(write-region (point-min) (point-max) tmpfil))
- TRAMP copies binary files incorrectly, Chris, 2007/01/10
- Re: TRAMP copies binary files incorrectly, Eli Zaretskii, 2007/01/10
- Re: TRAMP copies binary files incorrectly, Chris Moore, 2007/01/10
- Re: TRAMP copies binary files incorrectly,
Chris Moore <=
- Re: TRAMP copies binary files incorrectly, Stefan Monnier, 2007/01/10
- Re: TRAMP copies binary files incorrectly, Kenichi Handa, 2007/01/10
- Re: TRAMP copies binary files incorrectly, Stefan Monnier, 2007/01/11
- Re: TRAMP copies binary files incorrectly, Kenichi Handa, 2007/01/11
- Re: TRAMP copies binary files incorrectly, Chris Moore, 2007/01/11
- Re: TRAMP copies binary files incorrectly, Kenichi Handa, 2007/01/11
- Re: TRAMP copies binary files incorrectly, Chris Moore, 2007/01/11
- Re: TRAMP copies binary files incorrectly, Stefan Monnier, 2007/01/11
- Re: TRAMP copies binary files incorrectly, Katsumi Yamaoka, 2007/01/24
- Re: TRAMP copies binary files incorrectly, Kenichi Handa, 2007/01/24