GNU bug report logs - #17522
diff-mode frustrates attempt to correct corrupted diff file.

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Alan Mackenzie <acm@HIDDEN>; dated Sun, 18 May 2014 10:56:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 25 May 2014 20:18:19 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 25 16:18:19 2014
Received: from localhost ([127.0.0.1]:59924 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Woes6-0002e7-Bg
	for submit <at> debbugs.gnu.org; Sun, 25 May 2014 16:18:18 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:30562)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1Woes3-0002dr-S9
 for 17522 <at> debbugs.gnu.org; Sun, 25 May 2014 16:18:16 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ArUGAIDvNVNLd/fU/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ
X-IPAS-Result: ArUGAIDvNVNLd/fU/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ
X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="64105569"
Received: from 75-119-247-212.dsl.teksavvy.com (HELO pastel.home)
 ([75.119.247.212])
 by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
 25 May 2014 16:18:09 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id C394F60132; Sun, 25 May 2014 16:18:09 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted diff
 file.
Message-ID: <jwv7g59y5st.fsf-monnier+emacsbugs@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
 <20140521215636.GA3908@HIDDEN>
 <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
 <20140525160755.GA2777@HIDDEN>
Date: Sun, 25 May 2014 16:18:09 -0400
In-Reply-To: <20140525160755.GA2777@HIDDEN> (Alan Mackenzie's message of
 "Sun, 25 May 2014 16:07:55 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

>> diff-mode.el was partly changed to accommodate that looser format, but
>> not 100%.
> Why not?

The usual: lack of time/motivation/...

> If you're going to carry on making surreptitious changes to
> hunk headers, you'll need to determine the start and end of hunks
> reliably, especially corrupted hunks.  This can't be done with 100%
> certainty, and is going to involve heuristics.  A good way might be to
> scan a hunk _forwards_ counting lines before the first change to that
> hunk.

Exactly, with a before-change-function.

And if the hunk is found to be borked, then try to at least not make
things worse (and maybe suggest the use of diff-sanity-check-hunk, after
we make it into a command).


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 25 May 2014 16:12:16 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 25 12:12:16 2014
Received: from localhost ([127.0.0.1]:59822 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Wob1z-0004v5-Ux
	for submit <at> debbugs.gnu.org; Sun, 25 May 2014 12:12:16 -0400
Received: from colin.muc.de ([193.149.48.1]:27571 helo=mail.muc.de)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <acm@HIDDEN>) id 1Wob1w-0004uv-Dr
 for 17522 <at> debbugs.gnu.org; Sun, 25 May 2014 12:12:13 -0400
Received: (qmail 90452 invoked by uid 3782); 25 May 2014 16:12:10 -0000
Received: from acm.muc.de (pD95189FA.dip0.t-ipconnect.de [217.81.137.250]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sun, 25 May 2014 18:12:09 +0200
Received: (qmail 3216 invoked by uid 1000); 25 May 2014 16:07:55 -0000
Date: Sun, 25 May 2014 16:07:55 +0000
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted
 diff file.
Message-ID: <20140525160755.GA2777@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
 <20140521215636.GA3908@HIDDEN>
 <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

Hello, Stefan.

On Wed, May 21, 2014 at 09:32:11PM -0400, Stefan Monnier wrote:
> >> Maybe not a bug, but a misfeature: the ",0" is probably because the first
> >> line after the @...@ is empty, which normally "can't" be part of a hunk,
> >> so this empty line is taken as an "end of hunk".
> > OK.  But patch appears to accept a blank line (in a unified diff)
> > without complaint.

> Indeed, "patch" at some point was changed so as to accept empty lines.
> diff-mode.el was partly changed to accommodate that looser format, but
> not 100% (and in the case of updating line counts while editing the
> patch, it's a bit more delicate since, contrary to "patch" we can't
> rely on the line counts to decide whether an empty line marks the end of
> a hunk or not).

Why not?  If you're going to carry on making surreptitious changes to
hunk headers, you'll need to determine the start and end of hunks
reliably, especially corrupted hunks.  This can't be done with 100%
certainty, and is going to involve heuristics.  A good way might be to
scan a hunk _forwards_ counting lines before the first change to that
hunk.  We know that, in broken unified patches, empty lines are liable to
have their single space removed, and long lines are liable to be split.

> >> If you add a space on that line, the count should be updated again and
> >> start looking more sane.
> > This is all besides the point.  I did not edit the hunk header,
> > therefore I don't expect it to be changed behind my back.  If I need
> > the header to be recalculated, surely there should be a command
> > for that.

> diff-mode tries to be fancier and do that transparently.  You're just
> bumping into a bug of that code (regardless of how the empty-line is
> handled, a line count of 0 for both sides of the hunk is clearly not
> right).

[ .... ]

> BTW, I remember writing some kind of "fix corrupted hunk" code.
> Oh, yes, it's in diff-sanity-check-hunk.  Can you try to see if it can
> auto-fix your corrupted patch?

The code for diff-sanity-check-hunk is unfinished.  It asks "Try to
auto-fix word wrap damage?", but does nothing when you say yes.  It also
doesn't check the line counts, at least, not for unified diffs.

> M-x diff-goto-source RET is probably the easiest way to trigger it
> (sadly, it's not provided as a separate command).

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 24 May 2014 03:19:35 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 23:19:35 2014
Received: from localhost ([127.0.0.1]:58456 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Wo2Ug-0000r2-LA
	for submit <at> debbugs.gnu.org; Fri, 23 May 2014 23:19:34 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:37176)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1Wo2Ud-0000qk-EQ
 for 17522 <at> debbugs.gnu.org; Fri, 23 May 2014 23:19:32 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ
X-IPAS-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgEqRmBaoNMIQ
X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="63927334"
Received: from 206-248-164-30.dsl.teksavvy.com (HELO pastel.home)
 ([206.248.164.30])
 by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
 23 May 2014 23:19:25 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 45362601D9; Fri, 23 May 2014 23:19:25 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted diff
 file.
Message-ID: <jwvha4f50f0.fsf-monnier+emacsbugs@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
 <20140521215636.GA3908@HIDDEN>
 <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
 <20140522211407.GA3648@HIDDEN>
 <jwvvbsxmeny.fsf-monnier+emacsbugs@HIDDEN>
 <20140523204311.GA4111@HIDDEN>
Date: Fri, 23 May 2014 23:19:25 -0400
In-Reply-To: <20140523204311.GA4111@HIDDEN> (Alan Mackenzie's message of
 "Fri, 23 May 2014 20:43:11 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> Do you have a better proposal for a fix to this bug than my proposal?

Of course, I suggested to make the line-count-update more robust.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 23 May 2014 20:47:33 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri May 23 16:47:33 2014
Received: from localhost ([127.0.0.1]:58256 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnwNI-0004Fr-RL
	for submit <at> debbugs.gnu.org; Fri, 23 May 2014 16:47:33 -0400
Received: from colin.muc.de ([193.149.48.1]:51741 helo=mail.muc.de)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <acm@HIDDEN>) id 1WnwNE-0004Fe-BX
 for 17522 <at> debbugs.gnu.org; Fri, 23 May 2014 16:47:29 -0400
Received: (qmail 30645 invoked by uid 3782); 23 May 2014 20:47:26 -0000
Received: from acm.muc.de (pD951B7C5.dip0.t-ipconnect.de [217.81.183.197]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Fri, 23 May 2014 22:47:26 +0200
Received: (qmail 4194 invoked by uid 1000); 23 May 2014 20:43:12 -0000
Date: Fri, 23 May 2014 20:43:11 +0000
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted
 diff file.
Message-ID: <20140523204311.GA4111@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
 <20140521215636.GA3908@HIDDEN>
 <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
 <20140522211407.GA3648@HIDDEN>
 <jwvvbsxmeny.fsf-monnier+emacsbugs@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <jwvvbsxmeny.fsf-monnier+emacsbugs@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

Hi, Stefan.

On Thu, May 22, 2014 at 10:07:17PM -0400, Stefan Monnier wrote:
> > So why can't we have a `y-or-n-p' or a `message' when diff-mode is about
> > to change a hunk header, possibly fouling it up?

> Because we don't agree on UI issues.

Pardon?  What has our alleged disagreement about some UI issues (which
ones, by the way?) got to do with solving this bug?

To restore some context, what happened was that whilst editing a patch
file (which had become corrupted by email software) in Diff Mode, Diff
Mode, without seeking permission from or even informing the user,
corrupted a hunk header by writing 0 into the "number of lines" fields,
thus leaving the patch file unusable.

Do you think it is possible to amend the hunk header editing routine so
that it can't make such mistakes?  I'm sceptical.

Just to emphasise once more, it was the surreptitious nature of Diff
Mode's corruption that caused the pain.  If it had been open about its
changes, it would have been so much easier to reverse them.

Do you have a better proposal for a fix to this bug than my proposal?

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 23 May 2014 02:07:25 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 22:07:25 2014
Received: from localhost ([127.0.0.1]:57092 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnetJ-000666-BC
	for submit <at> debbugs.gnu.org; Thu, 22 May 2014 22:07:25 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:16810)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1WnetH-00065u-78
 for 17522 <at> debbugs.gnu.org; Thu, 22 May 2014 22:07:24 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgBA6kZgWqDTCE
X-IPAS-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjnoHhDgBA6kZgWqDTCE
X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="63803245"
Received: from 206-248-164-30.dsl.teksavvy.com (HELO fmsmemgm.homelinux.net)
 ([206.248.164.30])
 by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
 22 May 2014 22:07:17 -0400
Received: by fmsmemgm.homelinux.net (Postfix, from userid 20848)
 id 2A310AE0D2; Thu, 22 May 2014 22:07:17 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted diff
 file.
Message-ID: <jwvvbsxmeny.fsf-monnier+emacsbugs@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
 <20140521215636.GA3908@HIDDEN>
 <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
 <20140522211407.GA3648@HIDDEN>
Date: Thu, 22 May 2014 22:07:17 -0400
In-Reply-To: <20140522211407.GA3648@HIDDEN> (Alan Mackenzie's message of
 "Thu, 22 May 2014 21:14:07 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

> So why can't we have a `y-or-n-p' or a `message' when diff-mode is about
> to change a hunk header, possibly fouling it up?

Because we don't agree on UI issues.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 22 May 2014 21:18:27 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 22 17:18:27 2014
Received: from localhost ([127.0.0.1]:56973 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnaNe-00076J-UM
	for submit <at> debbugs.gnu.org; Thu, 22 May 2014 17:18:27 -0400
Received: from colin.muc.de ([193.149.48.1]:30629 helo=mail.muc.de)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <acm@HIDDEN>) id 1WnaNc-000766-3Y
 for 17522 <at> debbugs.gnu.org; Thu, 22 May 2014 17:18:24 -0400
Received: (qmail 91879 invoked by uid 3782); 22 May 2014 21:18:21 -0000
Received: from acm.muc.de (pD951A2AC.dip0.t-ipconnect.de [217.81.162.172]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Thu, 22 May 2014 23:18:20 +0200
Received: (qmail 3835 invoked by uid 1000); 22 May 2014 21:14:07 -0000
Date: Thu, 22 May 2014 21:14:07 +0000
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted
 diff file.
Message-ID: <20140522211407.GA3648@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
 <20140521215636.GA3908@HIDDEN>
 <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

Hi, Stefan.

On Wed, May 21, 2014 at 09:32:11PM -0400, Stefan Monnier wrote:
> >> If you add a space on that line, the count should be updated again and
> >> start looking more sane.
> > This is all besides the point.  I did not edit the hunk header,
> > therefore I don't expect it to be changed behind my back.  If I need
> > the header to be recalculated, surely there should be a command
> > for that.

> diff-mode tries to be fancier and do that transparently.

Yes, but it sometimes fails, and then this "transparently" becomes a
euphemism for "fouls it up in a manner causing the user the maximum
difficulty in seeing what has happened".

At this point you snipped the main point of my last post, which was
this:

> > At the very least, surely Diff Mode should _ask_ me before splatting
> > my file.  Or at the very, very least even _inform_ me that it has
> > done so, rather than leaving it up to patch to issue its bewildering
> > error message.

So why can't we have a `y-or-n-p' or a `message' when diff-mode is about
to change a hunk header, possibly fouling it up?  It is the "fanciness"
and "transparency" which caused me so much grief, the not realising that
the hunk header had been automatically changed.  It never occurred to me
that Diff Mode might do something like this (except for a dim memory
that something like this happened to me once before).

> You're just bumping into a bug of that code (regardless of how the
> empty-line is handled, a line count of 0 for both sides of the hunk is
> clearly not right).

Yes, but a line count of 1 for both sides, which might have happened if
the blank line was the second line in the hunk rather than the first,
would be equally not right.

> BTW, I remember writing some kind of "fix corrupted hunk" code.
> Oh, yes, it's in diff-sanity-check-hunk.  Can you try to see if it can
> auto-fix your corrupted patch?

It's getting late.  I'll have a look at this some time soon.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 22 May 2014 01:32:22 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 21 21:32:21 2014
Received: from localhost ([127.0.0.1]:55716 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnHrp-0004GT-3O
	for submit <at> debbugs.gnu.org; Wed, 21 May 2014 21:32:21 -0400
Received: from ironport2-out.teksavvy.com ([206.248.154.181]:44271)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1WnHrl-0004G4-SM
 for 17522 <at> debbugs.gnu.org; Wed, 21 May 2014 21:32:18 -0400
X-IronPort-Anti-Spam-Filtered: true
X-IronPort-Anti-Spam-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjhgRAVAHhDgEqRmBaoNMIYE1
X-IPAS-Result: ArUGAIDvNVPO+KQe/2dsb2JhbABZgwaDSsA9gRcXdIIlAQEBAQIBViMFCwsOJhIUGA0kiAQI0hkXjhgRAVAHhDgEqRmBaoNMIYE1
X-IronPort-AV: E=Sophos;i="4.97,753,1389762000"; d="scan'208";a="63613485"
Received: from 206-248-164-30.dsl.teksavvy.com (HELO pastel.home)
 ([206.248.164.30])
 by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA;
 21 May 2014 21:32:11 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 56E7B601F5; Wed, 21 May 2014 21:32:11 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted diff
 file.
Message-ID: <jwva9aa8vah.fsf-monnier+emacsbugs@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
 <20140521215636.GA3908@HIDDEN>
Date: Wed, 21 May 2014 21:32:11 -0400
In-Reply-To: <20140521215636.GA3908@HIDDEN> (Alan Mackenzie's message of
 "Wed, 21 May 2014 21:56:36 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.3 (/)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.3 (/)

>> Maybe not a bug, but a misfeature: the ",0" is probably because the first
>> line after the @...@ is empty, which normally "can't" be part of a hunk,
>> so this empty line is taken as an "end of hunk".
> OK.  But patch appears to accept a blank line (in a unified diff)
> without complaint.

Indeed, "patch" at some point was changed so as to accept empty lines.
diff-mode.el was partly changed to accommodate that looser format, but
not 100% (and in the case of updating line counts while editing the
patch, it's a bit more delicate since, contrary to "patch" we can't
rely on the line counts to decide whether an empty line marks the end of
a hunk or not).

>> If you add a space on that line, the count should be updated again and
>> start looking more sane.
> This is all besides the point.  I did not edit the hunk header,
> therefore I don't expect it to be changed behind my back.  If I need
> the header to be recalculated, surely there should be a command
> for that.

diff-mode tries to be fancier and do that transparently.  You're just
bumping into a bug of that code (regardless of how the empty-line is
handled, a line count of 0 for both sides of the hunk is clearly not
right).

> Why do people hand edit patches anyway?

All kinds of reasons.  The case of corrupted patches was definitely not
the main motivation for the line-count-update feature (after all, for
corrupted patches, you don't want to mess with the line counts).

BTW, I remember writing some kind of "fix corrupted hunk" code.
Oh, yes, it's in diff-sanity-check-hunk.  Can you try to see if it can
auto-fix your corrupted patch?
M-x diff-goto-source RET is probably the easiest way to trigger it
(sadly, it's not provided as a separate command).

> Clearly, because patches sometimes get corrupted, e.g. by email
> software, as happened to me.  For this case, it doesn't make sense to
> recalculate the header.  But for other reasons?

It can be easier to take a hunk and edit it to remove some of the
changes it performs, then it is to change the source code to then
re-generate a new hunk.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 21 May 2014 22:01:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed May 21 18:01:02 2014
Received: from localhost ([127.0.0.1]:55644 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WnEZJ-0004qI-J2
	for submit <at> debbugs.gnu.org; Wed, 21 May 2014 18:01:02 -0400
Received: from colin.muc.de ([193.149.48.1]:27347 helo=mail.muc.de)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <acm@HIDDEN>) id 1WnEZG-0004q4-76
 for 17522 <at> debbugs.gnu.org; Wed, 21 May 2014 18:00:59 -0400
Received: (qmail 29825 invoked by uid 3782); 21 May 2014 22:00:54 -0000
Received: from acm.muc.de (pD9518BA2.dip0.t-ipconnect.de [217.81.139.162]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Thu, 22 May 2014 00:00:53 +0200
Received: (qmail 4840 invoked by uid 1000); 21 May 2014 21:56:36 -0000
Date: Wed, 21 May 2014 21:56:36 +0000
To: Stefan Monnier <monnier@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted
 diff file.
Message-ID: <20140521215636.GA3908@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
 <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-Spam-Score: -1.4 (-)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.4 (-)

Hi, Stefan.

On Tue, May 20, 2014 at 09:54:02AM -0400, Stefan Monnier wrote:
> >     @@ -3155,0 +3160,0 @

> > .  This is surely a bug.  The workaround seems to be to use Fundamental
> > Mode.

> Maybe not a bug, but a misfeature: the ",0" is probably because the first
> line after the @...@ is empty, which normally "can't" be part of a hunk,
> so this empty line is taken as an "end of hunk".

OK.  But patch appears to accept a blank line (in a unified diff)
without complaint.

> If you add a space on that line, the count should be updated again and
> start looking more sane.

This is all besides the point.  I did not edit the hunk header,
therefore I don't expect it to be changed behind my back.  If I need the
header to be recalculated, surely there should be a command for that.
(There is, but it doesn't have a key binding.)  At the very least, surely
Diff Mode should _ask_ me before splatting my file.  Or at the very,
very least even _inform_ me that it has done so, rather than leaving it
up to patch to issue its bewildering error message.

Why do people hand edit patches anyway?  Clearly, because patches
sometimes get corrupted, e.g. by email software, as happened to me.  For
this case, it doesn't make sense to recalculate the header.  But for
other reasons?  Why would anybody edit a patch hunk other than to repair
it?  It's not something I can imagine myself wanting to do.

>         Stefan

-- 
Alan Mackenzie (Nuremberg, Germany).




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 20 May 2014 14:03:39 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue May 20 10:03:39 2014
Received: from localhost ([127.0.0.1]:54362 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Wmkdm-0001Mh-OQ
	for submit <at> debbugs.gnu.org; Tue, 20 May 2014 10:03:39 -0400
Received: from chene.dit.umontreal.ca ([132.204.246.20]:55663)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <monnier@HIDDEN>) id 1Wmkdk-0001MY-S9
 for 17522 <at> debbugs.gnu.org; Tue, 20 May 2014 10:03:37 -0400
Received: from pastel.home (lechon.iro.umontreal.ca [132.204.27.242])
 by chene.dit.umontreal.ca (8.14.1/8.14.1) with ESMTP id s4KE3Xxt002187;
 Tue, 20 May 2014 10:03:34 -0400
Received: by pastel.home (Postfix, from userid 20848)
 id 35EF960126; Tue, 20 May 2014 09:54:02 -0400 (EDT)
From: Stefan Monnier <monnier@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted diff
 file.
Message-ID: <jwvzjich82b.fsf-monnier+emacsbugs@HIDDEN>
References: <20140518105055.GA3727@HIDDEN>
Date: Tue, 20 May 2014 09:54:02 -0400
In-Reply-To: <20140518105055.GA3727@HIDDEN> (Alan Mackenzie's message of
 "Sun, 18 May 2014 10:50:55 +0000")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-NAI-Spam-Flag: NO
X-NAI-Spam-Threshold: 5
X-NAI-Spam-Score: 0
X-NAI-Spam-Rules: 1 Rules triggered
	RV4948=0
X-NAI-Spam-Version: 2.3.0.9378 : core <4948> : inlines <900> : streams
 <1188347> : uri <1762216>
X-Spam-Score: -2.0 (--)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.0 (--)

>     @@ -3155,0 +3160,0 @

> .  This is surely a bug.  The workaround seems to be to use Fundamental
> Mode.

Maybe not a bug, but a misfeature: the ",0" is probably because the first
line after the @...@ is empty, which normally "can't" be part of a hunk,
so this empty line is taken as an "end of hunk".
If you add a space on that line, the count should be updated again and
start looking more sane.


        Stefan




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at 17522 <at> debbugs.gnu.org:


Received: (at 17522) by debbugs.gnu.org; 19 May 2014 15:39:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon May 19 11:39:18 2014
Received: from localhost ([127.0.0.1]:53223 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1WmPej-0005Oa-0b
	for submit <at> debbugs.gnu.org; Mon, 19 May 2014 11:39:18 -0400
Received: from fencepost.gnu.org ([208.118.235.10]:52932 ident=Debian-exim)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <rgm@HIDDEN>) id 1WmPec-0005OM-0Y
 for 17522 <at> debbugs.gnu.org; Mon, 19 May 2014 11:39:11 -0400
Received: from rgm by fencepost.gnu.org with local (Exim 4.71)
 (envelope-from <rgm@HIDDEN>)
 id 1WmPea-0000t0-To; Mon, 19 May 2014 11:39:04 -0400
From: Glenn Morris <rgm@HIDDEN>
To: Alan Mackenzie <acm@HIDDEN>
Subject: Re: bug#17522: diff-mode frustrates attempt to correct corrupted diff
 file.
References: <20140518105055.GA3727@HIDDEN>
X-Spook: benelux bce beanpole FBI Echelon Soviet domestic
X-Ran: c\-[Wppo$lXS'7=.tZs^rCB_|zfP{YQ;SH,sVbK@n~jC7"e02a_=l0Cajh2?+3\*z-@rJF
X-Hue: blue
X-Debbugs-No-Ack: yes
X-Attribution: GM
Date: Mon, 19 May 2014 11:39:04 -0400
Message-ID: <pk4n0l93s7.fsf@HIDDEN>
User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
X-Spam-Score: -5.7 (-----)
X-Debbugs-Envelope-To: 17522
Cc: 17522 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.7 (-----)


It's presumably a useful thing to do when the diff is not corrupt, so
diff-mode would have to recognise when a diff is corrupt and turn off
this behaviour. A non-corrupt diff seems the more likely case?




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 May 2014 10:55:44 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 18 06:55:44 2014
Received: from localhost ([127.0.0.1]:51939 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1Wlykp-0003Mb-Lu
	for submit <at> debbugs.gnu.org; Sun, 18 May 2014 06:55:44 -0400
Received: from eggs.gnu.org ([208.118.235.92]:40660)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <acm@HIDDEN>) id 1Wlykl-0003MJ-Om
 for submit <at> debbugs.gnu.org; Sun, 18 May 2014 06:55:40 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <acm@HIDDEN>) id 1WlykW-0000M0-LY
 for submit <at> debbugs.gnu.org; Sun, 18 May 2014 06:55:34 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_20 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:55983)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1WlykW-0000Lw-Ir
 for submit <at> debbugs.gnu.org; Sun, 18 May 2014 06:55:24 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:42347)
 by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1WlykO-0006jt-Tn
 for bug-gnu-emacs@HIDDEN; Sun, 18 May 2014 06:55:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <acm@HIDDEN>) id 1WlykH-0000EA-Fi
 for bug-gnu-emacs@HIDDEN; Sun, 18 May 2014 06:55:16 -0400
Received: from colin.muc.de ([193.149.48.1]:33930 helo=mail.muc.de)
 by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from <acm@HIDDEN>)
 id 1WlykH-00009e-77
 for bug-gnu-emacs@HIDDEN; Sun, 18 May 2014 06:55:09 -0400
Received: (qmail 24752 invoked by uid 3782); 18 May 2014 10:55:05 -0000
Received: from acm.muc.de (pD951A2D8.dip0.t-ipconnect.de [217.81.162.216]) by
 colin.muc.de (tmda-ofmipd) with ESMTP;
 Sun, 18 May 2014 12:55:04 +0200
Received: (qmail 3921 invoked by uid 1000); 18 May 2014 10:50:55 -0000
Date: Sun, 18 May 2014 10:50:55 +0000
To: bug-gnu-emacs@HIDDEN
Subject: diff-mode frustrates attempt to correct corrupted diff file.
Message-ID: <20140518105055.GA3727@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Delivery-Agent: TMDA/1.1.12 (Macallan)
From: Alan Mackenzie <acm@HIDDEN>
X-Primary-Address: acm@HIDDEN
X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.3 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.3 (----)

Hi, Emacs.

On

GNU Emacs 24.4.50.2 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.7) of 2014-04-19 on acm.acm

, I have a diff which has been corrupted during transmission by email.  I
have loaded this diff into a Diff Mode buffer.  At the head of one of the
hunks appears:

    @@ -3155,115 +3160,38 @

, and three times in the hunk a long line has got split somehow, like
this:

   -                 (message "Eval error in the `c-lang-defvar' or `c-lang-setvar' for
   `%s'%s: %S"

.  When I attempt to correct the patch by removing the spurious line feed
using M-^, the header line is (silently) corrupted by replacing the two
"number of lines" fields with zeros, thusly:

    @@ -3155,0 +3160,0 @

.  This is surely a bug.  The workaround seems to be to use Fundamental
Mode.

-- 
Alan Mackenzie (Nuremberg, Germany).
 




Acknowledgement sent to Alan Mackenzie <acm@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#17522; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

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