Subject: bug#25010: closed (Re: bug#25010: 26.0.50; epatch might parse wrongly a file name)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 07 Dec 2016 12:14:02 +0000

Your bug report

#25010: 26.0.50; epatch might parse wrongly a file name

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
25010: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=25010
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#25010: 26.0.50; epatch might parse wrongly a file name
From: Tino Calancha <[email-masked]>
To: [email-masked]
Date: Wed, 07 Dec 2016 21:13:01 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

Pushed fix to master branch as commit 2c49705.

Subject: 26.0.50; epatch might parse wrongly a file name
From: Tino Calancha <[email-masked]>
To: [email-masked]
Date: Thu, 24 Nov 2016 15:24:31 +0900
List-Id: <debbugs-submit.debbugs.gnu.org>

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 <[email-masked]>
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 <[email-masked]>
+
+;; 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