GNU bug report logs - #25010
26.0.50; epatch might parse wrongly a file name

Previous Next

Package: emacs;

Reported by: Tino Calancha <tino.calancha <at> gmail.com>

Date: Thu, 24 Nov 2016 06:25:02 UTC

Severity: normal

Found in version 26.0.50

Done: Tino Calancha <tino.calancha <at> gmail.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 25010 in the body.
You can then email your comments to 25010 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#25010; Package emacs. (Thu, 24 Nov 2016 06:25:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Tino Calancha <tino.calancha <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 24 Nov 2016 06:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 26.0.50; epatch might parse wrongly a file name
Date: Thu, 24 Nov 2016 15:24:31 +0900
That's why sometimes while we are applying a multi-patch
we see a message similar as:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Ediff has inferred that
	/home/foo/emacs/ediff-mult.el
	/home/foo/emacs/ediff-mult.el
@@
are two possible targets for this patch.  However, these files do not exist.

Please enter an alternative patch target ...
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Note that it mentions 2 targets, but it shows the same file twice.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
From 2cc7a050a062cd3ea6051a4775001c8d10bc0aa6 Mon Sep 17 00:00:00 2001
From: Tino Calancha <tino.calancha <at> gmail.com>
Date: Thu, 24 Nov 2016 15:11:51 +0900
Subject: [PATCH] ediff-context-diff-label-regexp: Detect the end of second
 file

* lisp/vc/ediff-ptch.el (ediff-context-diff-label-regexp): Skip
'\n' in file names (Bug#25010).
* test/lisp/vc/ediff-ptch-tests.el: New file.
(ibuffer-test-bug25010): Add test for Bug#25010.
---
 lisp/vc/ediff-ptch.el            | 11 +++++-----
 test/lisp/vc/ediff-ptch-tests.el | 43 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 5 deletions(-)
 create mode 100644 test/lisp/vc/ediff-ptch-tests.el

diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index 6a07f80..6e8e947 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -120,11 +120,12 @@ ediff-patch-default-directory
 ;; This context diff does not recognize spaces inside files, but removing ' '
 ;; from [^ \t] breaks normal patches for some reason
 (defcustom ediff-context-diff-label-regexp
-  (concat "\\(" 	; context diff 2-liner
-	  "^\\*\\*\\* +\\([^ \t]+\\)[^*]+[\t ]*\n--- +\\([^ \t]+\\)"
-	  "\\|" 	; unified format diff 2-liner
-	  "^--- +\\([^ \t]+\\).*\n\\+\\+\\+ +\\([^ \t]+\\)"
-	  "\\)")
+  (let ((stuff "\\([^ \t\n]+\\)"))
+    (concat "\\(" 	; context diff 2-liner
+            "^\\*\\*\\* +" stuff "[^*]+[\t ]*\n--- +" stuff
+            "\\|" 	; unified format diff 2-liner
+            "^--- +" stuff ".*\n\\+\\+\\+ +" stuff
+            "\\)"))
   "Regexp matching filename 2-liners at the start of each context diff.
 You probably don't want to change that, unless you are using an obscure patch
 program."
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el
new file mode 100644
index 0000000..e201dfe
--- /dev/null
+++ b/test/lisp/vc/ediff-ptch-tests.el
@@ -0,0 +1,43 @@
+;;; ediff-ptch-tests.el --- Tests for ediff-ptch.el
+
+;; Copyright (C) 2016 Free Software Foundation, Inc.
+
+;; Author: Tino Calancha <tino.calancha <at> gmail.com>
+
+;; This program is free software: you can redistribute it and/or
+;; modify it under the terms of the GNU General Public License as
+;; published by the Free Software Foundation, either version 3 of the
+;; License, or (at your option) any later version.
+;;
+;; This program is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+;;
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see `http://www.gnu.org/licenses/'.
+
+;;; Code:
+
+(require 'ert)
+(require 'ediff-ptch)
+
+(ert-deftest ibuffer-test-bug25010 ()
+  "Test for http://debbugs.gnu.org/25010 ."
+  :expected-result :failed
+  (with-temp-buffer
+    (insert "diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
+index 6a07f80..6e8e947 100644
+--- a/lisp/vc/ediff-ptch.el
++++ b/lisp/vc/ediff-ptch.el
+@@ -120,11 +120,12 @@ ediff-patch-default-directory
+")
+    (goto-char (point-min))
+    (let ((filename
+           (progn
+             (re-search-forward ediff-context-diff-label-regexp nil t)
+             (match-string 1))))
+      (should-not (string-suffix-p "@@" filename)))))
+
+(provide 'ediff-ptch-tests)
+;;; ediff-ptch-tests.el ends here
-- 
2.10.2

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
In GNU Emacs 26.0.50.1 (x86_64-pc-linux-gnu, GTK+ Version 3.22.3)
 of 2016-11-24
Repository revision: dfc5b0f65531ef71cbd2c0cc956c246ea4239612




Reply sent to Tino Calancha <tino.calancha <at> gmail.com>:
You have taken responsibility. (Wed, 07 Dec 2016 12:14:02 GMT) Full text and rfc822 format available.

Notification sent to Tino Calancha <tino.calancha <at> gmail.com>:
bug acknowledged by developer. (Wed, 07 Dec 2016 12:14:02 GMT) Full text and rfc822 format available.

Message #10 received at 25010-done <at> debbugs.gnu.org (full text, mbox):

From: Tino Calancha <tino.calancha <at> gmail.com>
To: 25010-done <at> debbugs.gnu.org
Subject: Re: bug#25010: 26.0.50; epatch might parse wrongly a file name
Date: Wed, 07 Dec 2016 21:13:01 +0900
Pushed fix to master branch as commit 2c49705.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Wed, 04 Jan 2017 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 7 years and 325 days ago.

Previous Next


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