From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Reuben Thomas Newsgroups: gmane.emacs.bugs Subject: bug#18236: diff-apply-hunk interacts poorly with line endings Date: Wed, 17 Feb 2016 19:59:02 +0000 Message-ID: References: <87oabfz6xj.fsf@mbork.pl> <83twl7uw8l.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113edff48152d0052bfcae91 X-Trace: ger.gmane.org 1455739255 26420 80.91.229.3 (17 Feb 2016 20:00:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Feb 2016 20:00:55 +0000 (UTC) Cc: Marcin Borkowski , 18236@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 17 21:00:46 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aW8HE-0003Gd-MZ for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Feb 2016 21:00:44 +0100 Original-Received: from localhost ([::1]:32886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW8HE-0003l3-4w for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Feb 2016 15:00:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51301) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW8Gc-00030f-M9 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 15:00:07 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aW8GZ-0007Bx-E1 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 15:00:06 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34627) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW8GZ-0007Bt-B5 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 15:00:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aW8GY-0001Yt-TD for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 15:00:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Feb 2016 20:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 18236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 18236-submit@debbugs.gnu.org id=B18236.14557391505913 (code B ref 18236); Wed, 17 Feb 2016 20:00:02 +0000 Original-Received: (at 18236) by debbugs.gnu.org; 17 Feb 2016 19:59:10 +0000 Original-Received: from localhost ([127.0.0.1]:59987 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aW8Fi-0001XJ-8L for submit@debbugs.gnu.org; Wed, 17 Feb 2016 14:59:10 -0500 Original-Received: from mail-io0-f169.google.com ([209.85.223.169]:33642) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aW8Fg-0001X7-Ku for 18236@debbugs.gnu.org; Wed, 17 Feb 2016 14:59:09 -0500 Original-Received: by mail-io0-f169.google.com with SMTP id z135so49737781iof.0 for <18236@debbugs.gnu.org>; Wed, 17 Feb 2016 11:59:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Fcv08Pny8pK4eUaIVYTHKkhvioF1OufkxLdNxClHdEI=; b=2BZpR4GkYnKQrnVMM49PHk4JRyGOWXOMFklZkwa6Nz5VOY1LKRsLID0UEgf3h1qCTR IuI/49PoboHkp2sGYR+RPLBqkWnqn6cXfuJoVuLuDrq3QWaK+PP93Tx/7BvzYQFsntht yaFS964WfsBKpG2zaLTMgttypOfJ80MDEEdMQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Fcv08Pny8pK4eUaIVYTHKkhvioF1OufkxLdNxClHdEI=; b=icD5UVg0myvRMv/vbWRKMq/0quqcf330FLT4Zhsq8Cu/HXEHxCUcmcdX55z3aQZxDD rov1U/UCxsexd4AxbnQpU5zyB8+ks5skqtF289wSu8aP6273ZsUN2g/pdHI2BGF5JBe8 HhypS/D8muzjaAz/CPpeOROeHnj8ovzRZI0AvIKRMUTuib/yAvHo9O/wnb/5EC2NNb/1 YlnFO0EsnIXQQgC8VVoniUmdp/mVZmIlxl0opm1Zz+7gVVNecETAikyFzz3NkdPoN0k/ lVK+A/5W8ql+ZrrwpjaxJVfUdUJWzRKUAIiVjGm+0qkQml97UtgIDFmxkynqfnPFQC6B fvnw== X-Gm-Message-State: AG10YOQ6ho7XZiuDmQvyT4aSSy7nH0okWOeP2B39xFa+KbPvy06plBUch6r7r8+UPhPECxv2uIk6yzRhWo/R4aB+ X-Received: by 10.107.6.82 with SMTP id 79mr5034560iog.72.1455739143010; Wed, 17 Feb 2016 11:59:03 -0800 (PST) Original-Received: by 10.36.199.5 with HTTP; Wed, 17 Feb 2016 11:59:02 -0800 (PST) In-Reply-To: <83twl7uw8l.fsf@gnu.org> X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:113207 Archived-At: --001a113edff48152d0052bfcae91 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On 17 February 2016 at 16:39, Eli Zaretskii wrote: > > From: Marcin Borkowski > > Date: Wed, 17 Feb 2016 16:35:04 +0100 > > Cc: 18236@debbugs.gnu.org > > > > On 2014-08-10, at 17:34, Reuben Thomas 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. =E2=80=8BI just repeated the recipe, now in Emacs 24.4. It worked as descri= bed.=E2=80=8B > Is the recipe > =E2=80=8B =E2=80=8B > complete? =E2=80=8BSeems so.=E2=80=8B > Also, does this happen on a Posix host or on a Windows box? > =E2=80=8BOn a GNU/Linux system.=E2=80=8B > 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. =E2=80=8BYou're quite right, only the lines that co= me from the files being diffed end in ^M.=E2=80=8B However, the original problem =E2=80=8Bremains, as stated: after applying t= he patch hunk, the patched lines of the resultant file "bar" end \r\r\n. --=20 http://rrt.sc3d.org --001a113edff48152d0052bfcae91 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
On = 17 February 2016 at 16:39, Eli Zaretskii <eliz@gnu.org> wrote:
> From: Marcin Borkowski <mbork@mbork.pl>
> Date: Wed, 17 Feb 2016 16:35:04 +0100
> Cc: 18236@debbugs.gnu.org=
>
> On 2014-08-10, at 17:34, Reuben Thomas <rrt@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 t= ry 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.

=
=E2=80=8B= I just repeated the recipe, now in Emacs 24.4. It worked as described.=E2= =80=8B
=C2=A0
Is the r= ecipe
= =E2=80=8B =E2=80=8B
complete?

=E2=80=8BSeems so.=E2=80=8B<= /div>
=C2=A0
Also, does this = happen on a Posix host or on a Windows box?

=
=E2=80=8BOn a G= NU/Linux system.=E2=80=8B
=C2=A0
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. =E2=80=8BYou're quite right, only the lines th= at come from the files being diffed end in ^M.=E2=80=8B

Ho= wever, the original problem =E2=80=8Bremains, as stated: after applying the= patch hunk, the patched lines of the resultant file "bar" end \r= \r\n.

--
--001a113edff48152d0052bfcae91--