all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Philipp Stephani <p.stephani2@gmail.com>
To: 25949@debbugs.gnu.org
Subject: bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name
Date: Fri, 03 Mar 2017 16:59:49 +0000	[thread overview]
Message-ID: <CAArVCkRNpOS-rKOrJte81mDWn2CLanwvDS9QCYy-4cEznU0r_w@mail.gmail.com> (raw)
In-Reply-To: <wvr44lzawke4.fsf@a.muc.corp.google.com>


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

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

>
> emacs -Q
> C-x C-f /:/tmp/foobar.txt (it doesn't matter whether the file exists)
> M-: (process-file "true")
>
> will result in an error
>
> Debugger entered--Lisp error: (file-missing "Setting current directory"
> "No such file or directory" "/:/tmp/")
>   call-process("true" nil nil nil)
>   apply(call-process "true" nil nil nil nil)
>   process-file("true" nil nil nil)
>   apply(process-file ("true" nil nil nil))
>   file-name-non-special(process-file "true" nil nil nil)
>   apply(file-name-non-special process-file "true" nil nil nil nil)
>   process-file("true" nil nil nil)
>   apply(process-file ("true" nil nil nil))
>   tramp-run-real-handler(process-file ("true" nil nil nil))
>   tramp-file-name-handler(process-file "true" nil nil nil)
>   apply(tramp-file-name-handler process-file "true" nil nil nil nil)
>   process-file("true")
>   eval((process-file "true") nil)
>   eval-expression((process-file "true") nil)
>   funcall-interactively(eval-expression (process-file "true") nil)
>   call-interactively(eval-expression nil nil)
>   command-execute(eval-expression)
>
>
Attached a patch.

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

[-- Attachment #2: 0001-Make-process-file-resolve-the-default-directory.txt --]
[-- Type: text/plain, Size: 2159 bytes --]

From b6719f898fcec5d505c56f722365cde0d99fd10f Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Fri, 3 Mar 2017 17:56:01 +0100
Subject: [PATCH] Make process-file resolve the default directory

`call-process' doesn't respect file name handlers in
`default-directory', so `file-name-non-special' has to resolve them
for `process-file' (Bug#25959).

* lisp/files.el (file-name-non-special): Also resolve default directory
for 'process-file'.
* test/lisp/files-tests.el
(files-tests--file-name-non-special--process-files): Add unit test.
---
 lisp/files.el            | 8 +++++++-
 test/lisp/files-tests.el | 5 +++++
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/lisp/files.el b/lisp/files.el
index c7de4453d7..4a37bfe9e8 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -6906,7 +6906,13 @@ save-buffers-kill-terminal
 (defun file-name-non-special (operation &rest arguments)
   (let ((file-name-handler-alist nil)
 	(default-directory
-	  (if (eq operation 'insert-directory)
+          ;; Some operations respect file name handlers in
+          ;; `default-directory'.  Because core function like
+          ;; `call-process' don't care about file name handlers in
+          ;; `default-directory', we here have to resolve the
+          ;; directory into a local one.  For `process-file', this
+          ;; fixes Bug#25949.
+	  (if (memq operation '(insert-directory process-file))
 	      (directory-file-name
 	       (expand-file-name
 		(unhandled-file-name-directory default-directory)))
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el
index 9d456c512b..04e9ddd7d3 100644
--- a/test/lisp/files-tests.el
+++ b/test/lisp/files-tests.el
@@ -243,5 +243,10 @@ files-test-bug-18141-file
                          (concat "/:/:" subdir)))))
       (delete-directory dir 'recursive))))
 
+(ert-deftest files-tests--file-name-non-special--process-files ()
+  "Check that Bug#25949 is fixed."
+  (skip-unless (executable-find "true"))
+  (should (eq (let ((default-directory "/:/")) (process-file "true")) 0)))
+
 (provide 'files-tests)
 ;;; files-tests.el ends here
-- 
2.12.0.rc1.440.g5b76565f74-goog


  parent reply	other threads:[~2017-03-03 16:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03 13:38 bug#25949: 26.0.50; process-file fails when visiting a file with a quoted file name Philipp Stephani
2017-03-03 16:37 ` Philipp Stephani
2017-03-03 16:59 ` Philipp Stephani [this message]
2017-03-03 19:31   ` Michael Albinus
2017-04-04 12:35     ` 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

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

  git send-email \
    --in-reply-to=CAArVCkRNpOS-rKOrJte81mDWn2CLanwvDS9QCYy-4cEznU0r_w@mail.gmail.com \
    --to=p.stephani2@gmail.com \
    --cc=25949@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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.