* bug#13705: 24.2.93; "^M" characters in diff buffers
@ 2013-02-13 9:40 Dani Moncayo
2013-02-13 16:25 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Dani Moncayo @ 2013-02-13 9:40 UTC (permalink / raw)
To: 13705
[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]
Recipe from "emacs -Q":
1. Download the two attached files `fa' and `fb'.
2. M-x diff RET fb RET fa RET
In the *Diff* buffer, I see annoying/inappropriate "^M" characters at
the end of the compared lines. (see attached screenshot)
I see this bug both in the emacs-24 branch and the trunk.
In GNU Emacs 24.2.93.1 (i386-mingw-nt6.1.7601)
of 2013-02-10 on VBOX-W7
Bzr revision: 111243 michael.albinus@gmx.de-20130210100709-s22fi7zl9w92a8sa
Windowing system distributor `Microsoft Corp.', version 6.1.7601
Configured using:
`configure --with-gcc (4.7) --no-opt --enable-checking --cflags
-IC:/emacs/libs/libXpm-3.5.10/include -IC:/emacs/libs/libXpm-3.5.10/src
-IC:/emacs/libs/libpng-dev_1.4.3-1_win32/include
-IC:/emacs/libs/zlib-dev_1.2.5-2_win32/include
-IC:/emacs/libs/giflib-4.1.4-1-lib/include
-IC:/emacs/libs/jpeg-6b-4-lib/include
-IC:/emacs/libs/tiff-3.8.2-1-lib/include
-IC:/emacs/libs/libxml2-2.7.8-w32-bin/include/libxml2
-IC:/emacs/libs/gnutls-3.1.5-w32/include
-IC:/emacs/libs/libiconv-1.14-2-mingw32-dev/include'
--
Dani Moncayo
[-- Attachment #2: capture.png --]
[-- Type: image/png, Size: 6424 bytes --]
[-- Attachment #3: fa --]
[-- Type: application/octet-stream, Size: 3 bytes --]
a
[-- Attachment #4: fb --]
[-- Type: application/octet-stream, Size: 3 bytes --]
á
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#13705: 24.2.93; "^M" characters in diff buffers
2013-02-13 9:40 bug#13705: 24.2.93; "^M" characters in diff buffers Dani Moncayo
@ 2013-02-13 16:25 ` Eli Zaretskii
2013-02-13 18:59 ` Dani Moncayo
0 siblings, 1 reply; 4+ messages in thread
From: Eli Zaretskii @ 2013-02-13 16:25 UTC (permalink / raw)
To: Dani Moncayo; +Cc: 13705
> Date: Wed, 13 Feb 2013 10:40:22 +0100
> From: Dani Moncayo <dmoncayo@gmail.com>
>
> Recipe from "emacs -Q":
> 1. Download the two attached files `fa' and `fb'.
> 2. M-x diff RET fb RET fa RET
>
> In the *Diff* buffer, I see annoying/inappropriate "^M" characters at
> the end of the compared lines. (see attached screenshot)
It's most probably your Diff, not Emacs. I cannot reproduce the
problem with the version of Diff I have here (which is a GnuWin32
port). My crystal says that yours is from MSYS or maybe Cygwin, and
writes its output with Unix-style LF-only EOL format. That presents
to Emacs text that has inconsistent EOLs (because the files you diff
have DOS CR-LF EOLs), so Emacs punts and doesn't decode the EOL
format.
To see if my crystal ball is as clear as it gets, try this:
(let ((coding-system-for-read 'no-conversion))
(call-process shell-file-name nil t nil
shell-command-switch "diff -c fa fb"))
and look at the lines generated by Diff, like these:
*** fa 2013-02-12 18:41:03.201375000 +0200
--- fb 2013-02-08 16:25:03.161000000 +0200
If they don't have the ^M character at their end, your problem is as I
described.
With my Diff, the above snippet gives me _all_ the lines with ^M,
which is consistent.
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#13705: 24.2.93; "^M" characters in diff buffers
2013-02-13 16:25 ` Eli Zaretskii
@ 2013-02-13 18:59 ` Dani Moncayo
2013-02-13 21:44 ` Eli Zaretskii
0 siblings, 1 reply; 4+ messages in thread
From: Dani Moncayo @ 2013-02-13 18:59 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 13705-done
[-- Attachment #1: Type: text/plain, Size: 1976 bytes --]
> It's most probably your Diff, not Emacs. I cannot reproduce the
> problem with the version of Diff I have here (which is a GnuWin32
> port). My crystal says that yours is from MSYS or maybe Cygwin
Yes, my diff (at that moment) was from MSYS.
>, and
> writes its output with Unix-style LF-only EOL format. That presents
> to Emacs text that has inconsistent EOLs (because the files you diff
> have DOS CR-LF EOLs), so Emacs punts and doesn't decode the EOL
> format.
>
> To see if my crystal ball is as clear as it gets, try this:
>
> (let ((coding-system-for-read 'no-conversion))
> (call-process shell-file-name nil t nil
> shell-command-switch "diff -c fa fb"))
>
> and look at the lines generated by Diff, like these:
>
> *** fa 2013-02-12 18:41:03.201375000 +0200
> --- fb 2013-02-08 16:25:03.161000000 +0200
The above expression produces the output shown in
"Screenshot-MS-Windows.png" (attached).
> If they don't have the ^M character at their end, your problem is as I
> described.
>
> With my Diff, the above snippet gives me _all_ the lines with ^M,
> which is consistent.
Yes, the problem seems to be the one you've spotted, but note that
I've just reproduced the exact same problem on Ubuntu [1]. See the
screenshot "Screenshot-Ubuntu.png" (attached).
Therefore, the problem seems to be more general: it affects to every
diff made from two files with DOS-type EOLs, unless the "diff" program
is adapted to deal with this scenario (like the one from GnuWin32).
But anyway, if there is a problem here, it is not in Emacs, and
therefore, I'm closing this bug report.
As always, thanks for your time Eli.
---- Footnotes ----
[1]
In GNU Emacs 24.3.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 2.24.13)
of 2013-02-11 on LeG570-ubuntu
Bzr revision: 111735 eliz@gnu.org-20130211173232-odvn6s0c9gs3jclc
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description: Ubuntu 12.10
--
Dani Moncayo
[-- Attachment #2: Screenshot-MS-Windows.png --]
[-- Type: image/png, Size: 2707 bytes --]
[-- Attachment #3: Screenshot-Ubuntu.png --]
[-- Type: image/png, Size: 16964 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* bug#13705: 24.2.93; "^M" characters in diff buffers
2013-02-13 18:59 ` Dani Moncayo
@ 2013-02-13 21:44 ` Eli Zaretskii
0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2013-02-13 21:44 UTC (permalink / raw)
To: Dani Moncayo; +Cc: 13705
> Date: Wed, 13 Feb 2013 19:59:23 +0100
> From: Dani Moncayo <dmoncayo@gmail.com>
> Cc: 13705-done@debbugs.gnu.org
>
> > (let ((coding-system-for-read 'no-conversion))
> > (call-process shell-file-name nil t nil
> > shell-command-switch "diff -c fa fb"))
> >
> > and look at the lines generated by Diff, like these:
> >
> > *** fa 2013-02-12 18:41:03.201375000 +0200
> > --- fb 2013-02-08 16:25:03.161000000 +0200
>
> The above expression produces the output shown in
> "Screenshot-MS-Windows.png" (attached).
As expected.
> Yes, the problem seems to be the one you've spotted, but note that
> I've just reproduced the exact same problem on Ubuntu [1]. See the
> screenshot "Screenshot-Ubuntu.png" (attached).
On Ubuntu, it is expected to see the ^M characters, because that's
what you'd see if you invoke Diff from the shell prompt as well.
IOW, on Windows, two files which have DOS EOLs should not show ^M in
the Diff output, because DOS EOLs are native on Windows, and ^M at the
end of the line is not considered part of the text there. On Unix,
files with DOS EOLs are expected to be seen with the ^M explicit,
because it _is_ part of the text.
> Therefore, the problem seems to be more general: it affects to every
> diff made from two files with DOS-type EOLs, unless the "diff" program
> is adapted to deal with this scenario (like the one from GnuWin32).
It _is_ general, but it is not a problem. When Emacs sees
inconsistent EOL format it _always_ refrains from decoding the EOLs.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2013-02-13 21:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-13 9:40 bug#13705: 24.2.93; "^M" characters in diff buffers Dani Moncayo
2013-02-13 16:25 ` Eli Zaretskii
2013-02-13 18:59 ` Dani Moncayo
2013-02-13 21:44 ` Eli Zaretskii
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).