From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#18236: diff-apply-hunk interacts poorly with line endings Date: Wed, 17 Feb 2016 18:39:38 +0200 Message-ID: <83twl7uw8l.fsf@gnu.org> References: <87oabfz6xj.fsf@mbork.pl> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1455728250 8428 80.91.229.3 (17 Feb 2016 16:57:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 17 Feb 2016 16:57:30 +0000 (UTC) Cc: rrt@sc3d.org, 18236@debbugs.gnu.org To: Marcin Borkowski Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed Feb 17 17:57:18 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 1aW5Ph-0003Hl-WC for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Feb 2016 17:57:18 +0100 Original-Received: from localhost ([::1]:59563 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW5Ph-0000dH-6V for geb-bug-gnu-emacs@m.gmane.org; Wed, 17 Feb 2016 11:57:17 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59898) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW5PX-0000X1-Ck for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 11:57:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aW5PS-000615-VG for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 11:57:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:34449) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW5PS-000610-Rj for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 11:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84) (envelope-from ) id 1aW5PS-0000dx-J4 for bug-gnu-emacs@gnu.org; Wed, 17 Feb 2016 11:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Feb 2016 16:57: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.14557281962397 (code B ref 18236); Wed, 17 Feb 2016 16:57:02 +0000 Original-Received: (at 18236) by debbugs.gnu.org; 17 Feb 2016 16:56:36 +0000 Original-Received: from localhost ([127.0.0.1]:59797 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aW5P1-0000cb-Qw for submit@debbugs.gnu.org; Wed, 17 Feb 2016 11:56:36 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:40573) by debbugs.gnu.org with esmtp (Exim 4.84) (envelope-from ) id 1aW5P0-0000cM-IQ for 18236@debbugs.gnu.org; Wed, 17 Feb 2016 11:56:35 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aW58Q-0001YD-76 for 18236@debbugs.gnu.org; Wed, 17 Feb 2016 11:39:30 -0500 Original-Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55930) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aW58Q-0001Y6-3Y; Wed, 17 Feb 2016 11:39:26 -0500 Original-Received: from 84.94.185.246.cable.012.net.il ([84.94.185.246]:4684 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.82) (envelope-from ) id 1aW58P-0001HM-Em; Wed, 17 Feb 2016 11:39:25 -0500 In-reply-to: <87oabfz6xj.fsf@mbork.pl> (message from Marcin Borkowski on Wed, 17 Feb 2016 16:35:04 +0100) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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:113193 Archived-At: > 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. Is the recipe complete? Also, does this happen on a Posix host or on a Windows box? 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. I'm confused.