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: Sun, 10 Aug 2014 16:34:23 +0100 Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=089e011609d0396d860500482c1c X-Trace: ger.gmane.org 1407684915 32446 80.91.229.3 (10 Aug 2014 15:35:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 10 Aug 2014 15:35:15 +0000 (UTC) To: 18236@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Aug 10 17:35:09 2014 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 1XGV9I-0004R8-PL for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Aug 2014 17:35:08 +0200 Original-Received: from localhost ([::1]:60085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGV9I-0005Lm-Bv for geb-bug-gnu-emacs@m.gmane.org; Sun, 10 Aug 2014 11:35:08 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGV9E-0005KN-HJ for bug-gnu-emacs@gnu.org; Sun, 10 Aug 2014 11:35:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGV9D-0007Fs-KB for bug-gnu-emacs@gnu.org; Sun, 10 Aug 2014 11:35:04 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59135) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGV9D-0007Fa-GI for bug-gnu-emacs@gnu.org; Sun, 10 Aug 2014 11:35:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1XGV9C-0005wJ-UI for bug-gnu-emacs@gnu.org; Sun, 10 Aug 2014 11:35:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Reuben Thomas Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 10 Aug 2014 15:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 18236 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-emacs Original-Received: via spool by submit@debbugs.gnu.org id=B.140768488022794 (code B ref -1); Sun, 10 Aug 2014 15:35:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 10 Aug 2014 15:34:40 +0000 Original-Received: from localhost ([127.0.0.1]:37845 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGV8p-0005vX-4F for submit@debbugs.gnu.org; Sun, 10 Aug 2014 11:34:39 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:50075) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XGV8l-0005vI-2B for submit@debbugs.gnu.org; Sun, 10 Aug 2014 11:34:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGV8e-00075p-Qs for submit@debbugs.gnu.org; Sun, 10 Aug 2014 11:34:29 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:42029) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGV8e-00075l-NL for submit@debbugs.gnu.org; Sun, 10 Aug 2014 11:34:28 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:51786) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGV8d-0005HL-Bx for bug-gnu-emacs@gnu.org; Sun, 10 Aug 2014 11:34:28 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGV8c-00075N-BD for bug-gnu-emacs@gnu.org; Sun, 10 Aug 2014 11:34:27 -0400 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55213) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGV8c-00075J-7q for bug-gnu-emacs@gnu.org; Sun, 10 Aug 2014 11:34:26 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:47708) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1XGV8b-0005Pz-T3 for bug-emacs@gnu.org; Sun, 10 Aug 2014 11:34:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XGV8a-000754-M6 for bug-emacs@gnu.org; Sun, 10 Aug 2014 11:34:25 -0400 Original-Received: from mail-la0-x233.google.com ([2a00:1450:4010:c03::233]:40117) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XGV8a-00074y-E7 for bug-emacs@gnu.org; Sun, 10 Aug 2014 11:34:24 -0400 Original-Received: by mail-la0-f51.google.com with SMTP id pn19so5998784lab.10 for ; Sun, 10 Aug 2014 08:34:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sc3d.org; s=google; h=mime-version:date:message-id:subject:from:to:content-type; bh=t5bEWMujTI/J0pH0+0R5zZSn1jaxrudgG7fpMIV2FTE=; b=40SY8TIg4VLq38jUVLbsyubDJ9AhACgFT89lGuXocGrOlNAErgQGFNdF7B1sZcsZN5 bVXpW6HviLt7/ZF2ANLwAg80vAGAfw1CKxulGPCwWzcIhzWTj+WZnldrDkfxVk2OxETS ElTAaUnew4bYrVupmRmqylY4lIvtwBrEWxOdo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:date:message-id:subject:from:to :content-type; bh=t5bEWMujTI/J0pH0+0R5zZSn1jaxrudgG7fpMIV2FTE=; b=W4HrGKqM+3qNz7JapWB4zrdfl0AjR/7X8/kz239wQxwi0XwPHV3gWq32yBQOOoKJVA aboAdyQdcW/Cu7jP/DfQ/NTjadBwBdMS7XChx5QZx47r+NLuIIiykcf8K+677aObjVfT /35Mlur5nSFFEBwCKswzJt2b7UiaC83RSe9cL26hImk6zoO2PehLp3myRmizoWSPdI35 wrjgIrnwO4o5zxAGjUxXbKAAtQysBgp/HWQV5HF1Cjci0eGtPY3frRmG81jp/+YUiuMu 4NY8OK/MX7sWFk/b1RCJQeEOqNhwSKjHxuzbPyjUpFZfWXO/dhjDiqFPl0BfrrECMuEv Hz9Q== X-Gm-Message-State: ALoCoQnc2fuEqux4qfr6TlEcmmYa4HfG71WeZwvfBU74IOYIeJ1yCjLTQdwN1T7phqTRfWGHvHGK X-Received: by 10.112.138.195 with SMTP id qs3mr31718894lbb.49.1407684863152; Sun, 10 Aug 2014 08:34:23 -0700 (PDT) Original-Received: by 10.152.246.10 with HTTP; Sun, 10 Aug 2014 08:34:23 -0700 (PDT) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.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:92373 Archived-At: --089e011609d0396d860500482c1c Content-Type: text/plain; charset=UTF-8 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. -- http://rrt.sc3d.org --089e011609d0396d860500482c1c Content-Type: text/html; charset=UTF-8
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.
--089e011609d0396d860500482c1c--