GNU bug report logs - #18236
diff-apply-hunk interacts poorly with line endings

Previous Next

Package: emacs;

Reported by: Reuben Thomas <rrt <at> sc3d.org>

Date: Sun, 10 Aug 2014 15:35:02 UTC

Severity: normal

Tags: confirmed

Full log


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

From: Reuben Thomas <rrt <at> sc3d.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Marcin Borkowski <mbork <at> mbork.pl>, 18236 <at> debbugs.gnu.org
Subject: Re: bug#18236: diff-apply-hunk interacts poorly with line endings
Date: Wed, 17 Feb 2016 19:59:02 +0000
[Message part 1 (text/plain, inline)]
On 17 February 2016 at 16:39, Eli Zaretskii <eliz <at> gnu.org> wrote:

> > From: Marcin Borkowski <mbork <at> mbork.pl>
> > Date: Wed, 17 Feb 2016 16:35:04 +0100
> > Cc: 18236 <at> debbugs.gnu.org
> >
> > On 2014-08-10, at 17:34, Reuben Thomas <rrt <at> sc3d.org> wrote:
> >
> > > I'm using Emacs 24.3. Consider the following two files:
> > >
> > > foo:
> > > ----cut here----
> > > This is a small test file.
> > > It has DOS line endings.
> > > ----cut here----
> > >
> > > bar:
> > > ----cut here----
> > > This is a small test file.
> > > It too has DOS line endings.
> > > ----cut here----
> > >
> > > Save them with DOS line endings, and
> > >
> > > diff foo bar > foo.patch
> > > cp foo bar
> > >
> > > Visit foo.patch. When I do that, each line ends in ^M.
> > >
> > > Now, in the patch buffer, M-x diff-apply-hunk. Note that the ^Ms have
> been added to the lines. Writing the buffer and examination with "hd"
> reveals that each line now ends
> > > \r\r\n.
> > >
> > > It seems what's happened here is that diff-mode doesn't try to
> diagnose the character encoding of the patch file.
> >
> > Hi all,
> >
> > confirmed on GNU Emacs 25.1.50.2 (commit 4ccd268).
>
> When I try doing that, I get an error message.


​I just repeated the recipe, now in Emacs 24.4. It worked as described.​


> Is the recipe
> ​ ​
> complete?


​Seems so.​


> Also, does this happen on a Posix host or on a Windows box?
>

​On a GNU/Linux system.​


> If the former, I won't expect each line in the patch file to end with
> a ^M, only the lines that came from the files being diffed.
>

Sorry, I was imprecise. ​You're quite right, only the lines that come from
the files being diffed end in ^M.​

However, the original problem ​remains, as stated: after applying the patch
hunk, the patched lines of the resultant file "bar" end \r\r\n.

-- 
http://rrt.sc3d.org
[Message part 2 (text/html, inline)]

This bug report was last modified 9 years and 9 days ago.

Previous Next


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