GNU bug report logs - #8780
24.0.50; Coding system and eol style auto-detection after opening remote files

Previous Next

Package: emacs;

Reported by: Dani Moncayo <dmoncayo <at> gmail.com>

Date: Wed, 1 Jun 2011 08:27:02 UTC

Severity: normal

Found in version 24.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 8780 in the body.
You can then email your comments to 8780 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8780; Package emacs. (Wed, 01 Jun 2011 08:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dani Moncayo <dmoncayo <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 01 Jun 2011 08:27:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 24.0.50; Coding system and eol style auto-detection after opening
	remote files
Date: Wed, 1 Jun 2011 10:26:22 +0200
1. Start Emacs (emacs -Q).

2. Save the *scratch* buffer file to the local machine, in format
`iso-latin-1-dos'.

3. Put an exact copy of the above file into another machine accesible via ftp.

4. Open the local file (created in #2), and check the modeline flags
(coding system and eol style) and the buffer contents. --> Both look
right.

5. Open the remote file (C-x C-f /user <at> host:/path-to-file), and check
the modeline flags and buffer contents. --> Both look right too.

6. Kill both buffers and repeat step #4 and/or #5. --> Now the
behavior is different (and likely wrong): (a) the modeline flags say
nothing about the coding system, (b) the eol style supposedly is
(Unix) now, and thus the buffer shows ^M characters at the end of each
and every line.



In GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600)
 of 2011-05-31 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (4.5) --no-opt --cflags
-Ic:/build/include'


-- 
Dani Moncayo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8780; Package emacs. (Wed, 01 Jun 2011 13:27:01 GMT) Full text and rfc822 format available.

Message #8 received at 8780 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: 8780 <at> debbugs.gnu.org
Subject: Re: bug#8780: 24.0.50; Coding system and eol style auto-detection
	after opening remote files
Date: Wed, 1 Jun 2011 15:26:36 +0200
Simpler recipe:

0. Start Emacs: emacs -Q.
1. Visit any remote file (in any format): C-x C-f /user <at> host:/path-to-file.
2. From now on, any attempt to visit some iso-latin-1-dos file give
the abnormal results described in the OP.

-- 
Dani Moncayo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8780; Package emacs. (Wed, 08 Jun 2011 17:54:02 GMT) Full text and rfc822 format available.

Message #11 received at 8780 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: 8780 <at> debbugs.gnu.org
Subject: Re: bug#8780: 24.0.50; Coding system and eol style auto-detection
	after opening remote files
Date: Wed, 8 Jun 2011 19:53:10 +0200
Ping!

I'm experiencing this problem everyday at work.  Everyone who works
with remote files should be experiencing it too (and I think that is a
frequent practice among programmers).

I get abnormal results regardless of the coding system of the file.
So, here is an updated, description of the problem:

0. Start Emacs: emacs -Q.
1. Visit any _remote_ file: C-x C-f /user <at> host:/path-to-file.
2. Now, any attempt to visit any file (remote or local) gives abnormal
results(*).

(*):
a. The coding system flag is missing from the modeline.
b. If the file has DOS format, the eol-style flag is wrong (it
indicates UNIX style), and the buffer shows the ^M characters at the
end of each and every line.

-- 
Dani Moncayo




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8780; Package emacs. (Wed, 08 Jun 2011 20:57:01 GMT) Full text and rfc822 format available.

Message #14 received at 8780 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 8780 <at> debbugs.gnu.org
Subject: Re: bug#8780: 24.0.50;
	Coding system and eol style auto-detection after opening remote files
Date: Wed, 08 Jun 2011 23:56:07 +0300
> Date: Wed, 8 Jun 2011 19:53:10 +0200
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> 
> 0. Start Emacs: emacs -Q.
> 1. Visit any _remote_ file: C-x C-f /user <at> host:/path-to-file.
> 2. Now, any attempt to visit any file (remote or local) gives abnormal
> results(*).
> 
> (*):
> a. The coding system flag is missing from the modeline.
> b. If the file has DOS format, the eol-style flag is wrong (it
> indicates UNIX style), and the buffer shows the ^M characters at the
> end of each and every line.

I cannot reproduce this with yesterday's build of Emacs 24 on w32.  I
tried fetching a remote file from a GNU/Linux machine -- it was
displayed correctly and with the correct EOL mnemonic.  I then tried
visiting several local files, and they all also displayed correctly.
This is both using the default pscp method of accessing remote files
and with the plink method.

Are you using one of these Tramp methods?  If not, which method do you
use?




Information forwarded to owner <at> debbugs.gnu.org, bug-gnu-emacs <at> gnu.org:
bug#8780; Package emacs. (Wed, 08 Jun 2011 21:40:03 GMT) Full text and rfc822 format available.

Message #17 received at 8780 <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 8780 <at> debbugs.gnu.org
Subject: Re: bug#8780: 24.0.50; Coding system and eol style auto-detection
	after opening remote files
Date: Wed, 8 Jun 2011 23:38:52 +0200
[Message part 1 (text/plain, inline)]
Hi Eli,

> I cannot reproduce this with yesterday's build of Emacs 24 on w32.  I
> tried fetching a remote file from a GNU/Linux machine -- it was
> displayed correctly and with the correct EOL mnemonic.  I then tried
> visiting several local files, and they all also displayed correctly.

I've just reproduced it at home, also with yesterday's build of Emacs
trunk on w32.  FWIW, here I have Windows 7 Ultimate 64-bit.  I've just
done this:
 1. C-x C-f /ftp <at> ftp.gui.uva.es:/sites/ctan.org/README.uploads
 2. C-x C-f some-local-iso-latin-1-dos-file

I'm attaching a screenshot of the Emacs frame after #2, which shows
the two anomalies mentioned earlier.

At work I'm using a Windows XP box, where I also have the same problem.


> This is both using the default pscp method of accessing remote files
> and with the plink method.
>
> Are you using one of these Tramp methods?  If not, which method do you
> use?

Well, my knowledge of Tramp is quite limited.  I guess I'm using "ftp"
method, because it is the value of the variable
`tramp-default-method'.  Anyway, I've not tweaked anything in Emacs
nor Windows, FWIW.

If you need more data, just ask for it.

Thanks.

-- 
Dani Moncayo
[img1.png (image/png, attachment)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Thu, 09 Jun 2011 09:50:04 GMT) Full text and rfc822 format available.

Notification sent to Dani Moncayo <dmoncayo <at> gmail.com>:
bug acknowledged by developer. (Thu, 09 Jun 2011 09:50:04 GMT) Full text and rfc822 format available.

Message #22 received at 8780-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 8780-done <at> debbugs.gnu.org
Subject: Re: bug#8780: 24.0.50;
	Coding system and eol style auto-detection after opening remote files
Date: Thu, 09 Jun 2011 12:48:56 +0300
> Date: Wed, 8 Jun 2011 23:38:52 +0200
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> Cc: 8780 <at> debbugs.gnu.org
> 
>  1. C-x C-f /ftp <at> ftp.gui.uva.es:/sites/ctan.org/README.uploads

The "ftp@" part was the crucial detail that was missing from the
original report.  The bug was in ange-ftp.  It was a very old bug, but
it was exposed by fixing bug #7383 on the trunk: since now every file
is transferred in binary mode, that bug now affects many more files
than it did before.

I fixed it on the emacs-23 branch (revision 100596 there).  The
required one-line change is reproduced below, if you cannot wait for
it to be merged to the trunk.

I'm closing this bug report.

> Well, my knowledge of Tramp is quite limited.  I guess I'm using "ftp"
> method, because it is the value of the variable
> `tramp-default-method'.

"ftp" is the default only if you don't have PuTTY installed and on
PATH.

Here's the change to fix the bug:

=== modified file 'lisp/ChangeLog'
--- lisp/ChangeLog	2011-06-05 00:32:23 +0000
+++ lisp/ChangeLog	2011-06-09 09:40:51 +0000
@@ -1,3 +1,10 @@
+2011-06-09  Eli Zaretskii  <eliz <at> gnu.org>
+
+	* net/ange-ftp.el (ange-ftp-insert-file-contents): Let-bind
+	buffer-file-type before setting its value, to avoid disastrous
+	global effects on decoding files for DOS/Windows systems.
+	(Bug#8780)
+
 2011-06-05  Juanma Barranquero  <lekktu <at> gmail.com>
 
 	* progmodes/python.el (python-after-info-look): Add autoload cookie.

=== modified file 'lisp/net/ange-ftp.el'
--- lisp/net/ange-ftp.el	2011-01-02 23:50:46 +0000
+++ lisp/net/ange-ftp.el	2011-06-09 09:40:51 +0000
@@ -3290,6 +3290,7 @@ system TYPE.")
 		     (binary (or (ange-ftp-binary-file filename)
 				 (memq (ange-ftp-host-type host user)
 				       '(unix dumb-unix))))
+		     (buffer-file-type buffer-file-type)
 		     (abbr (ange-ftp-abbreviate-filename filename))
 		     (coding-system-used last-coding-system-used)
 		     size)





Message #23 received at 8780-done <at> debbugs.gnu.org (full text, mbox):

From: Dani Moncayo <dmoncayo <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 8780-done <at> debbugs.gnu.org
Subject: Re: bug#8780: 24.0.50; Coding system and eol style auto-detection
	after opening remote files
Date: Thu, 9 Jun 2011 14:25:19 +0200
> I fixed it on the emacs-23 branch (revision 100596 there).  The
> required one-line change is reproduced below, if you cannot wait for
> it to be merged to the trunk.

I've just tested your patch and it works :). Thanks a lot!


> "ftp" is the default only if you don't have PuTTY installed and on
> PATH.

Ah, I didn't know it.  Is it documented somewhere?  I've just checked
(info "(emacs)Remote Files"), but it seems to say nothing about that.

Also, I've tried to test that:
 * I've started Emacs from a console where the PATH environment
variable includes the "putty.exe" directory.
 * I've opened a remote file: C-x C-f /user <at> host:/path-to-file, where
user is not "ftp" and host doesn't begin with "ftp.".  But the
selected method seems to keep being "ftp".

What am I missing here?


-- 
Dani Moncayo




Message #24 received at 8780-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Dani Moncayo <dmoncayo <at> gmail.com>
Cc: 8780-done <at> debbugs.gnu.org
Subject: Re: bug#8780: 24.0.50;
	Coding system and eol style auto-detection after opening remote files
Date: Thu, 09 Jun 2011 16:05:34 +0300
> Date: Thu, 9 Jun 2011 14:25:19 +0200
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> Cc: 8780-done <at> debbugs.gnu.org
> 
> > I fixed it on the emacs-23 branch (revision 100596 there).  The
> > required one-line change is reproduced below, if you cannot wait for
> > it to be merged to the trunk.
> 
> I've just tested your patch and it works :). Thanks a lot!

Thanks for testing.

> > "ftp" is the default only if you don't have PuTTY installed and on
> > PATH.
> 
> Ah, I didn't know it.  Is it documented somewhere?  I've just checked
> (info "(emacs)Remote Files"), but it seems to say nothing about that.

It should be in the Tramp manual, but I don't find anything about how
the value of tramp-default-method is computed there.  Suggest to file
a bug report against Tramp documentation.

My conclusion that this is how Tramp behaves was based on what I see
on my system: when pscp is on PATH, tramp-default-method is "pscp";
otherwise it's "ftp".

> Also, I've tried to test that:
>  * I've started Emacs from a console where the PATH environment
> variable includes the "putty.exe" directory.
>  * I've opened a remote file: C-x C-f /user <at> host:/path-to-file, where
> user is not "ftp" and host doesn't begin with "ftp.".  But the
> selected method seems to keep being "ftp".
> 
> What am I missing here?

pscp will only work if you have an ssh login on that host.  Do you?





bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 08 Jul 2011 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 304 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.