diff options
| author | Michael Albinus | 2018-02-01 15:00:18 +0100 |
|---|---|---|
| committer | Michael Albinus | 2018-02-01 15:00:18 +0100 |
| commit | 01932c8decb79ab1b7bd5736f41fcfb604ab5141 (patch) | |
| tree | 1b83f569e52396789e8edbb0aad8c8ca75fb761a | |
| parent | 855ae578ab8999df56e54531815d6a15c67d85aa (diff) | |
| download | emacs-01932c8decb79ab1b7bd5736f41fcfb604ab5141.tar.gz emacs-01932c8decb79ab1b7bd5736f41fcfb604ab5141.zip | |
Revert a1bbc49015 (Bug#30243), do not merge
* lisp/files.el:
* test/lisp/net/tramp-tests.el: Revert a1bbc49015. (Bug#30243)
| -rw-r--r-- | lisp/files.el | 111 | ||||
| -rw-r--r-- | test/lisp/net/tramp-tests.el | 38 |
2 files changed, 69 insertions, 80 deletions
diff --git a/lisp/files.el b/lisp/files.el index 882eaa69677..46d4b0c3686 100644 --- a/lisp/files.el +++ b/lisp/files.el | |||
| @@ -6978,67 +6978,60 @@ only these files will be asked to be saved." | |||
| 6978 | ;; We depend on being the last handler on the list, | 6978 | ;; We depend on being the last handler on the list, |
| 6979 | ;; so that anything else which does need handling | 6979 | ;; so that anything else which does need handling |
| 6980 | ;; has been handled already. | 6980 | ;; has been handled already. |
| 6981 | ;; So it is safe for us to inhibit *all* magic file name handlers for | 6981 | ;; So it is safe for us to inhibit *all* magic file name handlers. |
| 6982 | ;; operations, which return a file name. See Bug#29579. | ||
| 6983 | 6982 | ||
| 6984 | (defun file-name-non-special (operation &rest arguments) | 6983 | (defun file-name-non-special (operation &rest arguments) |
| 6985 | (let* ((op-returns-file-name-list | 6984 | (let ((file-name-handler-alist nil) |
| 6986 | '(expand-file-name file-name-directory file-name-as-directory | 6985 | (default-directory |
| 6987 | directory-file-name file-name-sans-versions | 6986 | ;; Some operations respect file name handlers in |
| 6988 | find-backup-file-name file-remote-p)) | 6987 | ;; `default-directory'. Because core function like |
| 6989 | (file-name-handler-alist | 6988 | ;; `call-process' don't care about file name handlers in |
| 6990 | (and | 6989 | ;; `default-directory', we here have to resolve the |
| 6991 | (not (memq operation op-returns-file-name-list)) | 6990 | ;; directory into a local one. For `process-file', |
| 6992 | file-name-handler-alist)) | 6991 | ;; `start-file-process', and `shell-command', this fixes |
| 6993 | (default-directory | 6992 | ;; Bug#25949. |
| 6994 | ;; Some operations respect file name handlers in | 6993 | (if (memq operation '(insert-directory process-file start-file-process |
| 6995 | ;; `default-directory'. Because core function like | 6994 | shell-command)) |
| 6996 | ;; `call-process' don't care about file name handlers in | 6995 | (directory-file-name |
| 6997 | ;; `default-directory', we here have to resolve the | 6996 | (expand-file-name |
| 6998 | ;; directory into a local one. For `process-file', | 6997 | (unhandled-file-name-directory default-directory))) |
| 6999 | ;; `start-file-process', and `shell-command', this fixes | 6998 | default-directory)) |
| 7000 | ;; Bug#25949. | 6999 | ;; Get a list of the indices of the args which are file names. |
| 7001 | (if (memq operation | 7000 | (file-arg-indices |
| 7002 | '(insert-directory process-file start-file-process | 7001 | (cdr (or (assq operation |
| 7003 | shell-command)) | 7002 | ;; The first six are special because they |
| 7004 | (directory-file-name | 7003 | ;; return a file name. We want to include the /: |
| 7005 | (expand-file-name | 7004 | ;; in the return value. |
| 7006 | (unhandled-file-name-directory default-directory))) | 7005 | ;; So just avoid stripping it in the first place. |
| 7007 | default-directory)) | 7006 | '((expand-file-name . nil) |
| 7008 | ;; Get a list of the indices of the args which are file names. | 7007 | (file-name-directory . nil) |
| 7009 | (file-arg-indices | 7008 | (file-name-as-directory . nil) |
| 7010 | (cdr (or (assq operation | 7009 | (directory-file-name . nil) |
| 7011 | ;; The first seven are special because they | 7010 | (file-name-sans-versions . nil) |
| 7012 | ;; return a file name. We want to include the /: | 7011 | (find-backup-file-name . nil) |
| 7013 | ;; in the return value. | 7012 | ;; `identity' means just return the first arg |
| 7014 | ;; So just avoid stripping it in the first place. | 7013 | ;; not stripped of its quoting. |
| 7015 | (append | 7014 | (substitute-in-file-name identity) |
| 7016 | (mapcar 'list op-returns-file-name-list) | 7015 | ;; `add' means add "/:" to the result. |
| 7017 | '(;; `identity' means just return the first arg | 7016 | (file-truename add 0) |
| 7018 | ;; not stripped of its quoting. | 7017 | (insert-file-contents insert-file-contents 0) |
| 7019 | (substitute-in-file-name identity) | 7018 | ;; `unquote-then-quote' means set buffer-file-name |
| 7020 | ;; `add' means add "/:" to the result. | 7019 | ;; temporarily to unquoted filename. |
| 7021 | (file-truename add 0) | 7020 | (verify-visited-file-modtime unquote-then-quote) |
| 7022 | (insert-file-contents insert-file-contents 0) | 7021 | ;; List the arguments which are filenames. |
| 7023 | ;; `unquote-then-quote' means set buffer-file-name | 7022 | (file-name-completion 1) |
| 7024 | ;; temporarily to unquoted filename. | 7023 | (file-name-all-completions 1) |
| 7025 | (verify-visited-file-modtime unquote-then-quote) | 7024 | (write-region 2 5) |
| 7026 | ;; List the arguments which are filenames. | 7025 | (rename-file 0 1) |
| 7027 | (file-name-completion 1) | 7026 | (copy-file 0 1) |
| 7028 | (file-name-all-completions 1) | 7027 | (make-symbolic-link 0 1) |
| 7029 | (write-region 2 5) | 7028 | (add-name-to-file 0 1))) |
| 7030 | (rename-file 0 1) | 7029 | ;; For all other operations, treat the first argument only |
| 7031 | (copy-file 0 1) | 7030 | ;; as the file name. |
| 7032 | (copy-directory 0 1) | 7031 | '(nil 0)))) |
| 7033 | (file-in-directory-p 0 1) | 7032 | method |
| 7034 | (make-symbolic-link 0 1) | 7033 | ;; Copy ARGUMENTS so we can replace elements in it. |
| 7035 | (add-name-to-file 0 1)))) | 7034 | (arguments (copy-sequence arguments))) |
| 7036 | ;; For all other operations, treat the first argument only | ||
| 7037 | ;; as the file name. | ||
| 7038 | '(nil 0)))) | ||
| 7039 | method | ||
| 7040 | ;; Copy ARGUMENTS so we can replace elements in it. | ||
| 7041 | (arguments (copy-sequence arguments))) | ||
| 7042 | (if (symbolp (car file-arg-indices)) | 7035 | (if (symbolp (car file-arg-indices)) |
| 7043 | (setq method (pop file-arg-indices))) | 7036 | (setq method (pop file-arg-indices))) |
| 7044 | ;; Strip off the /: from the file names that have it. | 7037 | ;; Strip off the /: from the file names that have it. |
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el index 49d506bdd9e..996a31d375f 100644 --- a/test/lisp/net/tramp-tests.el +++ b/test/lisp/net/tramp-tests.el | |||
| @@ -1882,9 +1882,9 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 1882 | "Check `copy-file'." | 1882 | "Check `copy-file'." |
| 1883 | (skip-unless (tramp--test-enabled)) | 1883 | (skip-unless (tramp--test-enabled)) |
| 1884 | 1884 | ||
| 1885 | ;; `filename-non-special' has been fixed in Emacs 26.1, see Bug#29579. | 1885 | ;; TODO: The quoted case does not work. Copy local file to remote. |
| 1886 | (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs26-p)) | 1886 | ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) |
| 1887 | '(nil t) '(nil))) | 1887 | (let (quoted) |
| 1888 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) | 1888 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) |
| 1889 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) | 1889 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) |
| 1890 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) | 1890 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) |
| @@ -1984,9 +1984,9 @@ This checks also `file-name-as-directory', `file-name-directory', | |||
| 1984 | "Check `rename-file'." | 1984 | "Check `rename-file'." |
| 1985 | (skip-unless (tramp--test-enabled)) | 1985 | (skip-unless (tramp--test-enabled)) |
| 1986 | 1986 | ||
| 1987 | ;; `filename-non-special' has been fixed in Emacs 26.1, see Bug#29579. | 1987 | ;; TODO: The quoted case does not work. |
| 1988 | (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs26-p)) | 1988 | ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) |
| 1989 | '(nil t) '(nil))) | 1989 | (let (quoted) |
| 1990 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) | 1990 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) |
| 1991 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) | 1991 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) |
| 1992 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) | 1992 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) |
| @@ -2810,11 +2810,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2810 | ;; Symbolic links could look like a remote file name. | 2810 | ;; Symbolic links could look like a remote file name. |
| 2811 | ;; They must be quoted then. | 2811 | ;; They must be quoted then. |
| 2812 | (delete-file tmp-name2) | 2812 | (delete-file tmp-name2) |
| 2813 | (make-symbolic-link | 2813 | (make-symbolic-link "/penguin:motd:" tmp-name2) |
| 2814 | (funcall | ||
| 2815 | (if quoted 'tramp-compat-file-name-unquote 'identity) | ||
| 2816 | "/penguin:motd:") | ||
| 2817 | tmp-name2) | ||
| 2818 | (should (file-symlink-p tmp-name2)) | 2814 | (should (file-symlink-p tmp-name2)) |
| 2819 | (should | 2815 | (should |
| 2820 | (string-equal | 2816 | (string-equal |
| @@ -2829,7 +2825,7 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2829 | ;; We must unquote it. | 2825 | ;; We must unquote it. |
| 2830 | (should | 2826 | (should |
| 2831 | (string-equal | 2827 | (string-equal |
| 2832 | (tramp-compat-file-name-unquote (file-truename tmp-name1)) | 2828 | (file-truename tmp-name1) |
| 2833 | (tramp-compat-file-name-unquote (file-truename tmp-name3))))) | 2829 | (tramp-compat-file-name-unquote (file-truename tmp-name3))))) |
| 2834 | 2830 | ||
| 2835 | ;; Cleanup. | 2831 | ;; Cleanup. |
| @@ -2955,9 +2951,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 2955 | (skip-unless (tramp--test-enabled)) | 2951 | (skip-unless (tramp--test-enabled)) |
| 2956 | (skip-unless (file-acl tramp-test-temporary-file-directory)) | 2952 | (skip-unless (file-acl tramp-test-temporary-file-directory)) |
| 2957 | 2953 | ||
| 2958 | ;; `filename-non-special' has been fixed in Emacs 26.1, see Bug#29579. | 2954 | ;; TODO: The quoted case does not work. Copy local file to remote. |
| 2959 | (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs26-p)) | 2955 | ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) |
| 2960 | '(nil t) '(nil))) | 2956 | (let (quoted) |
| 2961 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) | 2957 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) |
| 2962 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) | 2958 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) |
| 2963 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) | 2959 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) |
| @@ -3033,9 +3029,9 @@ This tests also `make-symbolic-link', `file-truename' and `add-name-to-file'." | |||
| 3033 | (not (equal (file-selinux-context tramp-test-temporary-file-directory) | 3029 | (not (equal (file-selinux-context tramp-test-temporary-file-directory) |
| 3034 | '(nil nil nil nil)))) | 3030 | '(nil nil nil nil)))) |
| 3035 | 3031 | ||
| 3036 | ;; `filename-non-special' has been fixed in Emacs 26.1, see Bug#29579. | 3032 | ;; TODO: The quoted case does not work. Copy local file to remote. |
| 3037 | (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs26-p)) | 3033 | ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) |
| 3038 | '(nil t) '(nil))) | 3034 | (let (quoted) |
| 3039 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) | 3035 | (let ((tmp-name1 (tramp--test-make-temp-name nil quoted)) |
| 3040 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) | 3036 | (tmp-name2 (tramp--test-make-temp-name nil quoted)) |
| 3041 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) | 3037 | (tmp-name3 (tramp--test-make-temp-name 'local quoted))) |
| @@ -4086,9 +4082,9 @@ This requires restrictions of file name syntax." | |||
| 4086 | 4082 | ||
| 4087 | (defun tramp--test-check-files (&rest files) | 4083 | (defun tramp--test-check-files (&rest files) |
| 4088 | "Run a simple but comprehensive test over every file in FILES." | 4084 | "Run a simple but comprehensive test over every file in FILES." |
| 4089 | ;; `filename-non-special' has been fixed in Emacs 26.1, see Bug#29579. | 4085 | ;; TODO: The quoted case does not work. |
| 4090 | (dolist (quoted (if (and tramp--test-expensive-test (tramp--test-emacs26-p)) | 4086 | ;;(dolist (quoted (if tramp--test-expensive-test '(nil t) '(nil))) |
| 4091 | '(nil t) '(nil))) | 4087 | (let (quoted) |
| 4092 | ;; We must use `file-truename' for the temporary directory, | 4088 | ;; We must use `file-truename' for the temporary directory, |
| 4093 | ;; because it could be located on a symlinked directory. This | 4089 | ;; because it could be located on a symlinked directory. This |
| 4094 | ;; would let the test fail. | 4090 | ;; would let the test fail. |