unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#25950: 26.0.50; Ediff can't diff files with quoted file names
@ 2017-03-03 13:49 Philipp Stephani
  2017-03-03 17:38 ` Philipp Stephani
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Stephani @ 2017-03-03 13:49 UTC (permalink / raw)
  To: 25950


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



In GNU Emacs 26.0.50 (build 10, x86_64-unknown-linux-gnu, GTK+ Version 3.10.8)
 of 2017-03-03 built on localhost
Repository revision: 244de7b0ed3bb23e700c9edef51e413602d8720a
Windowing system distributor 'The X.Org Foundation', version 11.0.11501000
System Description:	Ubuntu 14.04 LTS

Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.

Configured using:
 'configure --enable-checking --enable-check-lisp-object-type
 --with-modules 'CFLAGS=-O0 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG SOUND GSETTINGS NOTIFY GNUTLS FREETYPE XFT ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 MODULES

Important settings:
  value of $LANG: en_US.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message puny seq byte-opt subr-x gv
bytecomp byte-compile cl-extra help-mode cconv cl-loaddefs pcase cl-lib
dired dired-loaddefs format-spec rfc822 mml easymenu mml-sec
password-cache epa derived epg epg-config gnus-util rmail rmail-loaddefs
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils
mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr
mail-utils time-date mule-util tooltip eldoc electric uniquify
ediff-hook vc-hooks lisp-float-type mwheel term/x-win x-win
term/common-win x-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript case-table epa-hook jka-cmpr-hook help
simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs button
faces cus-face macroexp files text-properties overlay sha1 md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote inotify dynamic-setting system-font-setting
font-render-setting move-toolbar gtk x-toolkit x multi-tty
make-network-process emacs)

Memory information:
((conses 16 96383 11358)
 (symbols 48 20188 1)
 (miscs 40 39 156)
 (strings 32 17680 5229)
 (string-bytes 1 576639)
 (vectors 16 14047)
 (vector-slots 8 483305 5817)
 (floats 8 48 68)
 (intervals 56 217 0)
 (buffers 976 12)
 (heap 1024 28085 1028))

-- 
Google Germany GmbH
Erika-Mann-Straße 33
80636 München

Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg
Geschäftsführer: Matthew Scott Sucherman, Paul Terence Manicle

Diese E-Mail ist vertraulich.  Wenn Sie nicht der richtige Adressat sind,
leiten Sie diese bitte nicht weiter, informieren Sie den Absender und löschen
Sie die E-Mail und alle Anhänge.  Vielen Dank.

This e-mail is confidential.  If you are not the right addressee please do not
forward it, please inform the sender, and please erase this e-mail including
any attachments.  Thanks.





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

* bug#25950: 26.0.50; Ediff can't diff files with quoted file names
  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
  2017-04-04  9:41   ` Philipp Stephani
  0 siblings, 1 reply; 3+ messages in thread
From: Philipp Stephani @ 2017-03-03 17:38 UTC (permalink / raw)
  To: 25950


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


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

* bug#25950: 26.0.50; Ediff can't diff files with quoted file names
  2017-03-03 17:38 ` Philipp Stephani
@ 2017-04-04  9:41   ` Philipp Stephani
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Stephani @ 2017-04-04  9:41 UTC (permalink / raw)
  To: 25950-done

[-- Attachment #1: Type: text/plain, Size: 495 bytes --]

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

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

Pushed as  f4b50dad8d to master.

[-- Attachment #2: Type: text/html, Size: 1586 bytes --]

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

end of thread, other threads:[~2017-04-04  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2017-04-04  9:41   ` Philipp Stephani

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).