unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: 25950@debbugs.gnu.org
Subject: bug#25950: 26.0.50; Ediff can't diff files with quoted file names
Date: Fri, 03 Mar 2017 17:38:41 +0000	[thread overview]
Message-ID: <CAArVCkSqxYG+yqdf=sGv_MUyALwO0rRHnx+jB+EaPFeBcPXLNA@mail.gmail.com> (raw)
In-Reply-To: <wvr437eu8o81.fsf@a.muc.corp.google.com>


[-- Attachment #1.1: Type: text/plain, Size: 357 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am Fr., 3. März 2017 um
14:50 Uhr:

>
> Assuming that /tmp/{a,b}.py exist:
>
> M-x ediff RET /:/tmp/a.py RET /:/tmp.b.py RET
>
> will result in an error
>
> /usr/bin/diff: /:/tmp/a.py: No such file or directory
> /usr/bin/diff: /:/tmp/b.py: No such file or directory
>
>
>
Attached a patch.

[-- Attachment #1.2: Type: text/html, Size: 941 bytes --]

[-- Attachment #2: 0001-Make-ediff-handle-remote-and-quoted-file-names.txt --]
[-- Type: text/plain, Size: 3299 bytes --]

From 8bb9ca88a21d6a7e1fb8ba523c59691277b6ba27 Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Fri, 3 Mar 2017 18:36:08 +0100
Subject: [PATCH] Make ediff handle remote and quoted file names

Quoted file names need to be unquoted before passed to
subprocesses (Bug#25950).

* lisp/vc/ediff-diff.el (ediff-exec-process): Handle remote and quoted
file names.
* test/lisp/vc/ediff-diff-tests.el
(ediff-diff-tests--ediff-exec-process--quoted-file): Add unit test.
---
 lisp/vc/ediff-diff.el            |  6 +++++-
 test/lisp/vc/ediff-diff-tests.el | 44 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)
 create mode 100644 test/lisp/vc/ediff-diff-tests.el

diff --git a/lisp/vc/ediff-diff.el b/lisp/vc/ediff-diff.el
index 37f22340d7..cfa08ef360 100644
--- a/lisp/vc/ediff-diff.el
+++ b/lisp/vc/ediff-diff.el
@@ -1149,7 +1149,11 @@ ediff-exec-process
 	     ediff-coding-system-for-write
 	   ediff-coding-system-for-read))
 	args)
-    (setq args (append (split-string options) files))
+    (setq args (append (split-string options)
+                       (mapcar (lambda (file)
+                                 (file-name-unquote
+                                  (or (file-local-copy file) file)))
+                               files)))
     (setq args (delete "" (delq nil args))) ; delete nil and "" from arguments
     ;; the --binary option, if present, should be used only for buffer jobs
     ;; or for refining the differences
diff --git a/test/lisp/vc/ediff-diff-tests.el b/test/lisp/vc/ediff-diff-tests.el
new file mode 100644
index 0000000000..aacc8bfed2
--- /dev/null
+++ b/test/lisp/vc/ediff-diff-tests.el
@@ -0,0 +1,44 @@
+;;; ediff-diff-tests.el --- Unit tests for ediff-diff.el  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2017  Free Software Foundation, Inc.
+
+;; Author: Philipp Stephani <phst@google.com>
+
+;; This file is part of GNU Emacs.
+
+;; GNU Emacs 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.
+
+;; GNU Emacs 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 GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; Unit tests for lisp/vc/ediff-diff.el.
+
+;;; Code:
+
+(require 'ediff-diff)
+
+(require 'cl-lib)
+(require 'ert)
+
+(ert-deftest ediff-diff-tests--ediff-exec-process--quoted-file ()
+  "Check that Bug#25950 is fixed."
+  (cl-letf* ((call-process-args ())
+             ((symbol-function #'call-process)
+              (lambda (&rest args) (push args call-process-args) 0)))
+    (with-temp-buffer
+      (ediff-exec-process "diff" (current-buffer) :synchronous ""
+                          "/:/a" "/:/b")
+      (should (equal call-process-args
+                     `(("diff" nil ,(current-buffer) nil "/a" "/b")))))))
+
+;;; ediff-diff-tests.el ends here
-- 
2.12.0.rc1.440.g5b76565f74-goog


  reply	other threads:[~2017-03-03 17:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 13:49 bug#25950: 26.0.50; Ediff can't diff files with quoted file names Philipp Stephani
2017-03-03 17:38 ` Philipp Stephani [this message]
2017-04-04  9:41   ` Philipp Stephani

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAArVCkSqxYG+yqdf=sGv_MUyALwO0rRHnx+jB+EaPFeBcPXLNA@mail.gmail.com' \
    --to=p.stephani2@gmail.com \
    --cc=25950@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).