From b6719f898fcec5d505c56f722365cde0d99fd10f Mon Sep 17 00:00:00 2001 From: Philipp Stephani 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