GNU bug report logs -
#13705
24.2.93; "^M" characters in diff buffers
Previous Next
Reported by: Dani Moncayo <dmoncayo <at> gmail.com>
Date: Wed, 13 Feb 2013 09:42:01 UTC
Severity: normal
Found in version 24.2.93
Done: Dani Moncayo <dmoncayo <at> gmail.com>
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 13705 in the body.
You can then email your comments to 13705 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13705
; Package
emacs
.
(Wed, 13 Feb 2013 09:42:01 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, 13 Feb 2013 09:42:01 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
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 <at> 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
[capture.png (image/png, attachment)]
[fa (application/octet-stream, attachment)]
[fb (application/octet-stream, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13705
; Package
emacs
.
(Wed, 13 Feb 2013 16:26:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 13705 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 13 Feb 2013 10:40:22 +0100
> From: Dani Moncayo <dmoncayo <at> 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.
Reply sent
to
Dani Moncayo <dmoncayo <at> gmail.com>
:
You have taken responsibility.
(Wed, 13 Feb 2013 19:01:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Dani Moncayo <dmoncayo <at> gmail.com>
:
bug acknowledged by developer.
(Wed, 13 Feb 2013 19:01:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 13705-done <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
> 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 <at> gnu.org-20130211173232-odvn6s0c9gs3jclc
Windowing system distributor `The X.Org Foundation', version 11.0.11300000
System Description: Ubuntu 12.10
--
Dani Moncayo
[Screenshot-MS-Windows.png (image/png, attachment)]
[Screenshot-Ubuntu.png (image/png, attachment)]
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#13705
; Package
emacs
.
(Wed, 13 Feb 2013 21:46:02 GMT)
Full text and
rfc822 format available.
Message #16 received at 13705 <at> debbugs.gnu.org (full text, mbox):
> Date: Wed, 13 Feb 2013 19:59:23 +0100
> From: Dani Moncayo <dmoncayo <at> gmail.com>
> Cc: 13705-done <at> 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.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 14 Mar 2013 11:24:03 GMT)
Full text and
rfc822 format available.
This bug report was last modified 12 years and 192 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.