GNU logs - #43297, boring messages


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#43297: 27.1; corrupts patch when diff-update-on-the-fly is set to nil
Resent-From: Mark H Weaver <mhw@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Wed, 09 Sep 2020 19:53:01 +0000
Resent-Message-ID: <handler.43297.B.159968113225296 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: report 43297
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: 43297 <at> debbugs.gnu.org
X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN
Received: via spool by submit <at> debbugs.gnu.org id=B.159968113225296
          (code B ref -1); Wed, 09 Sep 2020 19:53:01 +0000
Received: (at submit) by debbugs.gnu.org; 9 Sep 2020 19:52:12 +0000
Received: from localhost ([127.0.0.1]:34803 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kG68Z-0006Zw-OO
	for submit <at> debbugs.gnu.org; Wed, 09 Sep 2020 15:52:12 -0400
Received: from lists.gnu.org ([209.51.188.17]:56130)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <mhw@HIDDEN>) id 1kG68X-0006Zo-DL
 for submit <at> debbugs.gnu.org; Wed, 09 Sep 2020 15:52:10 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:45260)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mhw@HIDDEN>) id 1kG68X-0002sD-57
 for bug-gnu-emacs@HIDDEN; Wed, 09 Sep 2020 15:52:09 -0400
Received: from world.peace.net ([64.112.178.59]:35420)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <mhw@HIDDEN>) id 1kG68U-0000DI-Ri
 for bug-gnu-emacs@HIDDEN; Wed, 09 Sep 2020 15:52:08 -0400
Received: from mhw by world.peace.net with esmtpsa
 (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92)
 (envelope-from <mhw@HIDDEN>)
 id 1kG68H-0005Fc-8j; Wed, 09 Sep 2020 15:51:53 -0400
From: Mark H Weaver <mhw@HIDDEN>
Date: Wed, 09 Sep 2020 15:50:36 -0400
Message-ID: <87r1rag254.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
Received-SPF: pass client-ip=64.112.178.59; envelope-from=mhw@HIDDEN;
 helo=world.peace.net
X-detected-operating-system: by eggs.gnu.org: First seen = 2020/09/09 15:51:54
X-ACL-Warn: Detected OS   = Linux 2.2.x-3.x [generic] [fuzzy]
X-Spam_score_int: -18
X-Spam_score: -1.9
X-Spam_bar: -
X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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.3 (--)

I don't know if this behavior is new in 27.1, but that's the only
version I've tried this on.

When I set 'diff-update-on-the-fly' to nil, I find that some patches are
consistently corrupted when I save them while in diff-mode.  See below
for an example patch that demonstrates this behavior.

To reproduce:

* Save the example patch below to "test.patch", and make another copy
  in "test2.patch".

* Launch "emacs -nw -q"  (I used Emacs 27.1)

* Evaluate (setq diff-update-on-the-fly nil)

* Find file "test2.patch".

* Add a character anywhere in the buffer and then delete it, such that
  the buffer is now in a "modified" state.

* Save the file.

* Run "diff -u test.patch test2.patch" in the shell.

* Here's the result that I see:

--8<---------------cut here---------------start------------->8---
--- test.patch
+++ test2.patch
@@ -39,7 +39,7 @@
  
  	var elements = document.getElementsByTagName("style");
  	for(var i = 0; i < elements.length; i++){
-@@ -41,16 +48,20 @@ function reveal_css(){
+@@ -41,17 +48,20 @@ function reveal_css(){
  
  		}
  	}
--8<---------------cut here---------------end--------------->8---

Emacs corrupts the line count of the final hunk, making it one larger
than it should be (17 instead of 16).  This breaks the patch, such that
attempts to apply it will fail.

Note that the example patch includes the following footer immediately
after the last hunk, added by "git format-patch":

--8<---------------cut here---------------start------------->8---
-- 
2.26.2
--8<---------------cut here---------------end--------------->8---

My guess is that the line with "--" is being interpreted as a deleted
line, part of the hunk.  This bug only seems to happen when
'diff-update-on-the-fly' is set to nil.

The example patch that demonstrates this problem follows.

     Thanks,
       Mark


--8<---------------cut here---------------start------------->8---
From 2e8618d22568b6e00892a17303d437dd700eca98 Mon Sep 17 00:00:00 2001
From: Mark H Weaver <mhw@HIDDEN>
Date: Tue, 5 May 2020 21:27:41 -0400
Subject: [PATCH] Revert "Update Reveal hidden HTML."

I prefer the user interface of the old version.

This reverts commit f6e3adb6b2344ee2c7bb453a305fd2d6fb4c194c.
---
 .../passive_improve_css.js                    | 23 ++++++++++++++-----
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/data/extensions/SubmitMe@HIDDEN/passive_improve_css.js b/data/extensions/SubmitMe@HIDDEN/passive_improve_css.js
index 7692990..ca57982 100644
--- a/data/extensions/SubmitMe@HIDDEN/passive_improve_css.js
+++ b/data/extensions/SubmitMe@HIDDEN/passive_improve_css.js
@@ -10,6 +10,8 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
 */
 
 
+var bad = [];
+
 function escapeHTML (unsafe_str) {
     return unsafe_str
       .replace(/&/g, '&amp;')
@@ -20,9 +22,14 @@ function escapeHTML (unsafe_str) {
       .replace(/\//g, '&#x2F;')
 }
 
+function dounhide(){
+        for(var i = 0; i < bad.length; i++){
+                        bad[i].remove();
+                }
+}
+
 console.log("passive_improve_css.js");
 function reveal_css(){
-	var bad = [];
 
 	var elements = document.getElementsByTagName("style");
 	for(var i = 0; i < elements.length; i++){
@@ -41,16 +48,20 @@ function reveal_css(){
 
 		}
 	}
-	if(bad.length > 0 && window.confirm("Hidden HTML detected, would you like to reveal it?")){
-		for(var i = 0; i < bad.length; i++){
-			bad[i].remove();
-		}
+	if(bad.length > 0){
+		const insertedDiv = document.createElement('div');
+		insertedDiv.innerHTML= '<p id="unhide" class="button white" style="text-decoration:none!important; color:#000!important;  font-size:1em !important; font-family:\'sans-serif\'!important; font-weight:normal !important; background-color:transparent!important; margin:0!important; padding:0!important; font-size:10px!important; line-height:1!important"' +
+			'alt="Click to reveal hidden elements in this page">' +
+	                '<span>Reveal hidden elements</span>' +
+			'</a>';
+		insertedDiv.style="position:fixed; bottom:1em; right:1em; opacity:0.8; z-index: 2147483647 !important; border-radius: 3px !important; background-color: #fff !important; padding: 0.5em !important;   box-shadow: 0 0 3px grey !important; font-color:#bbb!important; cursor: pointer!important;";
+		insertedDiv.addEventListener("click", dounhide, false);
+		document.body.insertBefore(insertedDiv, document.body.firstChild);
 	}
 }
 
 reveal_css();
 
-
 /*
 var a = document.getElementsByTagName("style")[2];
 var btn = document.createElement("style");        // Create a <button> element
-- 
2.26.2

--8<---------------cut here---------------end--------------->8---




Message sent:


Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-Mailer: MIME-tools 5.505 (Entity 5.505)
Content-Type: text/plain; charset=utf-8
X-Loop: help-debbugs@HIDDEN
From: help-debbugs@HIDDEN (GNU bug Tracking System)
To: Mark H Weaver <mhw@HIDDEN>
Subject: bug#43297: Acknowledgement (27.1; corrupts patch when
 diff-update-on-the-fly is set to nil)
Message-ID: <handler.43297.B.159968113225296.ack <at> debbugs.gnu.org>
References: <87r1rag254.fsf@HIDDEN>
X-Gnu-PR-Message: ack 43297
X-Gnu-PR-Package: emacs
Reply-To: 43297 <at> debbugs.gnu.org
Date: Wed, 09 Sep 2020 19:53:01 +0000

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs@HIDDEN

If you wish to submit further information on this problem, please
send it to 43297 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs@HIDDEN unless you wish
to report a problem with the Bug-tracking system.

--=20
43297: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D43297
GNU Bug Tracking System
Contact help-debbugs@HIDDEN with problems


Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#43297: 27.1; corrupts patch when diff-update-on-the-fly is set to nil
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 16 Oct 2020 06:50:02 +0000
Resent-Message-ID: <handler.43297.B43297.160283098919583 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 43297
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: 
To: Mark H Weaver <mhw@HIDDEN>
Cc: 43297 <at> debbugs.gnu.org
Received: via spool by 43297-submit <at> debbugs.gnu.org id=B43297.160283098919583
          (code B ref 43297); Fri, 16 Oct 2020 06:50:02 +0000
Received: (at 43297) by debbugs.gnu.org; 16 Oct 2020 06:49:49 +0000
Received: from localhost ([127.0.0.1]:57399 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kTJYi-00055m-LH
	for submit <at> debbugs.gnu.org; Fri, 16 Oct 2020 02:49:48 -0400
Received: from quimby.gnus.org ([95.216.78.240]:51752)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kTJYg-00055X-L5
 for 43297 <at> debbugs.gnu.org; Fri, 16 Oct 2020 02:49:47 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=1lxj+78AzD1U3xXyzi/Ij0/qSIrt9MJOk2fyy8H/11M=; b=E7TXDRwXXPw3k9ufR0kjG1cffj
 BreTo8DmQwj8RehiVhjgzj+CWRJzK2kvG9j7BTXXoyaGDd7bn9+JJ4OSVqRwMHH8y0C+3fvgogu1j
 Ng8a9lHU4AWxP/6GWtvBBn0V+yy/U3NWyyAnkDSJ0DSRHj78O5tUd8bOGItr/u/JCJNQ=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kTJYU-00085O-5A; Fri, 16 Oct 2020 08:49:40 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87r1rag254.fsf@HIDDEN>
X-Now-Playing: The Human League's _Secrets_: "Reflections"
Date: Fri, 16 Oct 2020 08:49:32 +0200
In-Reply-To: <87r1rag254.fsf@HIDDEN> (Mark H. Weaver's message of "Wed, 09
 Sep 2020 15:50:36 -0400")
Message-ID: <87y2k6oebn.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview: Mark H Weaver <mhw@HIDDEN> writes: > When I set
 'diff-update-on-the-fly'
 to nil, I find that some patches are > consistently corrupted when I save
 them while in diff-mode. See below > for an example patch that demonstrates
 this behavio [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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.0 (-)

Mark H Weaver <mhw@HIDDEN> writes:

> When I set 'diff-update-on-the-fly' to nil, I find that some patches are
> consistently corrupted when I save them while in diff-mode.  See below
> for an example patch that demonstrates this behavior.

This bug is still present in Emacs 28.

An easier way to reproduce this bug is to just load the example patch
into a buffer and then eval-ing

  (diff-fixup-modifs (point-min) (point-max))

This shouldn't change the contents, but it does.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




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


Received: (at control) by debbugs.gnu.org; 16 Oct 2020 06:49:57 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Oct 16 02:49:57 2020
Received: from localhost ([127.0.0.1]:57402 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kTJYq-00056A-TY
	for submit <at> debbugs.gnu.org; Fri, 16 Oct 2020 02:49:57 -0400
Received: from quimby.gnus.org ([95.216.78.240]:51766)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kTJYp-00055u-03
 for control <at> debbugs.gnu.org; Fri, 16 Oct 2020 02:49:55 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc:
 MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID:
 Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc
 :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=AH+M2iTN3wbkUsBuD0K3+VQOVdmnHiMoW4ADRfKKyoc=; b=nDnTIxyrVN01nu4Y4RuLcXRxrh
 +N1GC7est5O6428p4b1vmDTskujMOuw55crCX3im/RvrPbXBZsUfSC9cf0E3IDaj3GCwS3Y8OfZcR
 uaemlvNOWf2c0PZfa6pGvEt7g65kFPt/bdi0jN9Z1RqLjLvMfbezp5C/ey15rrLu1Zqg=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>) id 1kTJYh-00085a-5Q
 for control <at> debbugs.gnu.org; Fri, 16 Oct 2020 08:49:49 +0200
Date: Fri, 16 Oct 2020 08:49:45 +0200
Message-Id: <87wnzqoeba.fsf@HIDDEN>
To: control <at> debbugs.gnu.org
From: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: control message for bug #43297
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  tags 43297 + confirmed quit 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: control
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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.0 (-)

tags 43297 + confirmed
quit





Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#43297: 27.1; corrupts patch when diff-update-on-the-fly is set to nil
Resent-From: Lars Ingebrigtsen <larsi@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 16 Oct 2020 07:03:01 +0000
Resent-Message-ID: <handler.43297.B43297.160283172727567 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 43297
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: confirmed
To: Mark H Weaver <mhw@HIDDEN>
Cc: 43297 <at> debbugs.gnu.org
Received: via spool by 43297-submit <at> debbugs.gnu.org id=B43297.160283172727567
          (code B ref 43297); Fri, 16 Oct 2020 07:03:01 +0000
Received: (at 43297) by debbugs.gnu.org; 16 Oct 2020 07:02:07 +0000
Received: from localhost ([127.0.0.1]:57423 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kTJkc-0007AF-FA
	for submit <at> debbugs.gnu.org; Fri, 16 Oct 2020 03:02:06 -0400
Received: from quimby.gnus.org ([95.216.78.240]:51832)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1kTJkb-00074B-1a
 for 43297 <at> debbugs.gnu.org; Fri, 16 Oct 2020 03:02:05 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org;
 s=20200322; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:
 References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding:
 Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender:
 Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:
 List-Subscribe:List-Post:List-Owner:List-Archive;
 bh=Oy/uFvNe589s8Si6K2TnpWU2c7Muj7dtzGBXlN6PdBc=; b=QljfPHkHSn6JuJdZkDoIbI5hm3
 78JV2zKc99iApKdpzfVvvj6WLduRpPBZljCr4/yYjRN41mp1Ocw7olaZWCe8veDKjMVRtfIn09X+s
 A/38xKMpiR3Eo0r+oBKw2TirYZch8vQWSVcgDUNnYXqRrySG34XqchUZGYN+cpe5gCn0=;
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=xo)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1kTJkR-0008EZ-RH; Fri, 16 Oct 2020 09:01:58 +0200
From: Lars Ingebrigtsen <larsi@HIDDEN>
References: <87r1rag254.fsf@HIDDEN> <87y2k6oebn.fsf@HIDDEN>
X-Now-Playing: The Human League's _Secrets_: "Sin City"
Date: Fri, 16 Oct 2020 09:01:54 +0200
In-Reply-To: <87y2k6oebn.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Fri,
 16 Oct 2020 08:49:32 +0200")
Message-ID: <87sgaeodr1.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 Content preview:  Lars Ingebrigtsen <larsi@HIDDEN> writes: > An easier way
 to reproduce this bug is to just load the example patch > into a buffer and
 then eval-ing > > (diff-fixup-modifs (point-min) (point-max)) > > This
 shouldn't change the contents, but it [...] 
 Content analysis details:   (-2.9 points, 5.0 required)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
 [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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.0 (-)

Lars Ingebrigtsen <larsi@HIDDEN> writes:

> An easier way to reproduce this bug is to just load the example patch
> into a buffer and then eval-ing
>
>   (diff-fixup-modifs (point-min) (point-max))
>
> This shouldn't change the contents, but it does.

Poking around in the code shows that it is indeed the signature that
triggers the misbehaviour.  It goes to the end of the buffer and then
goes backward, line by line, and this is triggered:

	      (pcase (char-after)
		(?\s (cl-incf space))
		(?+ (cl-incf plus))
		(?- (cl-incf minus))

Which makes it fix the line numbers in the hunk incorrectly.

I'm not familiar with this code at all -- it seems to be written with
the idea that there's just a patch in the current buffer, and nothing
else.  (At least at the end of the buffer.)  And here's it's a patch in
an email, so there's extra stuff.

I don't see any obvious ways of fixing this...  anybody got any ideas?

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Message sent to bug-gnu-emacs@HIDDEN:


X-Loop: help-debbugs@HIDDEN
Subject: bug#43297: 27.1; corrupts patch when diff-update-on-the-fly is set to nil
Resent-From: Robert Pluim <rpluim@HIDDEN>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
Resent-CC: bug-gnu-emacs@HIDDEN
Resent-Date: Fri, 16 Oct 2020 08:30:03 +0000
Resent-Message-ID: <handler.43297.B43297.160283696321474 <at> debbugs.gnu.org>
Resent-Sender: help-debbugs@HIDDEN
X-GNU-PR-Message: followup 43297
X-GNU-PR-Package: emacs
X-GNU-PR-Keywords: confirmed
To: Lars Ingebrigtsen <larsi@HIDDEN>
Cc: Mark H Weaver <mhw@HIDDEN>, 43297 <at> debbugs.gnu.org
Received: via spool by 43297-submit <at> debbugs.gnu.org id=B43297.160283696321474
          (code B ref 43297); Fri, 16 Oct 2020 08:30:03 +0000
Received: (at 43297) by debbugs.gnu.org; 16 Oct 2020 08:29:23 +0000
Received: from localhost ([127.0.0.1]:57593 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1kTL75-0005aI-C1
	for submit <at> debbugs.gnu.org; Fri, 16 Oct 2020 04:29:23 -0400
Received: from mail-wm1-f46.google.com ([209.85.128.46]:40471)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <rpluim@HIDDEN>) id 1kTL74-0005a5-Fq
 for 43297 <at> debbugs.gnu.org; Fri, 16 Oct 2020 04:29:22 -0400
Received: by mail-wm1-f46.google.com with SMTP id k18so1895450wmj.5
 for <43297 <at> debbugs.gnu.org>; Fri, 16 Oct 2020 01:29:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;
 h=from:to:cc:subject:references:date:in-reply-to:message-id
 :mime-version; bh=ctj/Bb87B11x7kQMjB2HtJXlT0NpxmTdE3I2wBtiXp8=;
 b=O4K9Hbxwb8JYdsB431XqIlamkYKuTikq/zQDjcco4rYoSLj03RycO47M0OBws+03yT
 Luz7QVElc4raM8EV2nG3WmiA8h1eg9gzUTjj4fEOZwzeM4dkKRCoDEscCyvPPB2HH5f7
 xKDIR+MxvKrztlg5S4/YIv76eUeej6eIuj0jn4+ciwJ1cMRU6LLTfoiUAlf5c1eGDMU3
 +fkRLoLFJUTIO39w6pLfzac8qz66t5GjtpP5ILpKP/D7I43C9pKPCIQc4lmNRtVgiTwV
 2d6LjJpMh0T2yl8b8E+oxWXFdYTIfZqINZGYhqbdGItgyChKIKYqeksCpyxWJEU5TCzS
 Mppg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20161025;
 h=x-gm-message-state:from:to:cc:subject:references:date:in-reply-to
 :message-id:mime-version;
 bh=ctj/Bb87B11x7kQMjB2HtJXlT0NpxmTdE3I2wBtiXp8=;
 b=DvbiLJqVGEmljTNEFXDFDaZetM4qAheGlSu7rv1PQ3fNCnByHkmniY/CTKZBA3ywvp
 TqxrSdOXAyeriAE7QYk5g0cbQmtVPiyXjA8phg6rhhaDSRnQd1a3Ebvh3PBzA8c56ITG
 isNWxPF+qkPgj4mGsMctSToKDa+NthQFNYgFLRA5AiPRdMaNf4zw/NJseivaDei5K6vX
 hpoOFqH82B6m3gUHoN0ytcdw7yQbSS5B8OWhruBZDajC+Pjp0l3Y82dlSnP08W8zzagr
 cu60WLpEYex2HfIWYgd247kd8QzB+zRUCQneKdPSk+LVjeYamlDtgPRfSvXSYyLcG2Eh
 d4NA==
X-Gm-Message-State: AOAM533X+LehdjnxjGILqoEMColpYERVjmtW6NO8+Lhmr7UO/LJxBix+
 QlW5leVhbJ0lAf7RkLdZlxQZ3NFU/h8=
X-Google-Smtp-Source: ABdhPJynSPMxDQ+2yb+lfgO+ZpuAtcPvZLj44RvB5F2pileGmwypeSQ0TTz8Ti+yqOhl98HfNVG/2Q==
X-Received: by 2002:a1c:bc05:: with SMTP id m5mr2818781wmf.68.1602836956343;
 Fri, 16 Oct 2020 01:29:16 -0700 (PDT)
Received: from rpluim-mac ([2a01:e34:ecfc:a860:9474:cfb2:b9a9:23d4])
 by smtp.gmail.com with ESMTPSA id r3sm2475887wrm.51.2020.10.16.01.29.15
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Fri, 16 Oct 2020 01:29:15 -0700 (PDT)
From: Robert Pluim <rpluim@HIDDEN>
References: <87r1rag254.fsf@HIDDEN> <87y2k6oebn.fsf@HIDDEN>
 <87sgaeodr1.fsf@HIDDEN>
Date: Fri, 16 Oct 2020 10:29:14 +0200
In-Reply-To: <87sgaeodr1.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Fri,
 16 Oct 2020 09:01:54 +0200")
Message-ID: <m2ft6einfp.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: 0.0 (/)
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://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: <https://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.0 (-)

>>>>> On Fri, 16 Oct 2020 09:01:54 +0200, Lars Ingebrigtsen <larsi@HIDDEN> said:

    Lars> Lars Ingebrigtsen <larsi@HIDDEN> writes:
    >> An easier way to reproduce this bug is to just load the example patch
    >> into a buffer and then eval-ing
    >> 
    >> (diff-fixup-modifs (point-min) (point-max))
    >> 
    >> This shouldn't change the contents, but it does.

    Lars> Poking around in the code shows that it is indeed the signature that
    Lars> triggers the misbehaviour.  It goes to the end of the buffer and then
    Lars> goes backward, line by line, and this is triggered:

    Lars> 	      (pcase (char-after)
    Lars> 		(?\s (cl-incf space))
    Lars> 		(?+ (cl-incf plus))
    Lars> 		(?- (cl-incf minus))

    Lars> Which makes it fix the line numbers in the hunk incorrectly.

    Lars> I'm not familiar with this code at all -- it seems to be written with
    Lars> the idea that there's just a patch in the current buffer, and nothing
    Lars> else.  (At least at the end of the buffer.)  And here's it's a patch in
    Lars> an email, so there's extra stuff.

    Lars> I don't see any obvious ways of fixing this...  anybody got any ideas?

Search backwards from end-of-buffer for "-- " and then narrow the
buffer from (point-min) to there? Kind of hacky I guess, but otherwise
you'll have to complicate the pcase.

Robert
-- 





Last modified: Fri, 16 Oct 2020 08:45:01 UTC

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