unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25010: 26.0.50; epatch might parse wrongly a file name
@ 2016-11-24  6:24 Tino Calancha
  2016-12-07 12:13 ` Tino Calancha
  0 siblings, 1 reply; 2+ messages in thread
From: Tino Calancha @ 2016-11-24  6:24 UTC (permalink / raw)
  To: 25010


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@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@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





^ permalink raw reply related	[flat|nested] 2+ messages in thread

* bug#25010: 26.0.50; epatch might parse wrongly a file name
  2016-11-24  6:24 bug#25010: 26.0.50; epatch might parse wrongly a file name Tino Calancha
@ 2016-12-07 12:13 ` Tino Calancha
  0 siblings, 0 replies; 2+ messages in thread
From: Tino Calancha @ 2016-12-07 12:13 UTC (permalink / raw)
  To: 25010-done

Pushed fix to master branch as commit 2c49705.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-07 12:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-24  6:24 bug#25010: 26.0.50; epatch might parse wrongly a file name Tino Calancha
2016-12-07 12:13 ` Tino Calancha

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).