diff options
| author | Michael Albinus | 2019-04-17 14:04:37 +0200 |
|---|---|---|
| committer | Michael Albinus | 2019-04-17 14:04:37 +0200 |
| commit | 2c06731dca42ee4f10484a6c72b3528e14c548d7 (patch) | |
| tree | b504a55790771a9eaa08e5c7b55c5b4902e9687b /test | |
| parent | 48a6a3ac028181dbe32f6619982539adb0cd9a6a (diff) | |
| download | emacs-2c06731dca42ee4f10484a6c72b3528e14c548d7.tar.gz emacs-2c06731dca42ee4f10484a6c72b3528e14c548d7.zip | |
Fix Bug#35241
* lisp/files.el (executable-find): Quote default-directory. (Bug#35241)
* test/lisp/files-tests.el (files-tests-executable-find): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/files-tests.el | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/lisp/files-tests.el b/test/lisp/files-tests.el index 13e8bb4943c..53e6e9064a1 100644 --- a/test/lisp/files-tests.el +++ b/test/lisp/files-tests.el | |||
| @@ -1218,5 +1218,31 @@ See <https://debbugs.gnu.org/19657#20>." | |||
| 1218 | process-environment))) | 1218 | process-environment))) |
| 1219 | (should (equal old (file-truename (abbreviate-file-name testfile)))))) | 1219 | (should (equal old (file-truename (abbreviate-file-name testfile)))))) |
| 1220 | 1220 | ||
| 1221 | (ert-deftest files-tests-executable-find () | ||
| 1222 | "Test that `executable-find' works also with a relative or remote PATH. | ||
| 1223 | See <https://debbugs.gnu.org/35241>." | ||
| 1224 | (let ((tmpfile (make-temp-file "files-test"))) | ||
| 1225 | (unwind-protect | ||
| 1226 | (progn | ||
| 1227 | (set-file-modes tmpfile #o777) | ||
| 1228 | (let ((exec-path `(,temporary-file-directory))) | ||
| 1229 | (should | ||
| 1230 | (equal tmpfile | ||
| 1231 | (executable-find (file-name-nondirectory tmpfile))))) | ||
| 1232 | ;; An empty element of `exec-path' means `default-directory'. | ||
| 1233 | (let ((default-directory temporary-file-directory) | ||
| 1234 | (exec-path nil)) | ||
| 1235 | (should | ||
| 1236 | (equal tmpfile | ||
| 1237 | (executable-find (file-name-nondirectory tmpfile))))) | ||
| 1238 | ;; The remote file name shall be quoted, and handled like a | ||
| 1239 | ;; non-existing directory. | ||
| 1240 | (let ((default-directory "/ssh::") | ||
| 1241 | (exec-path (append exec-path `("." ,temporary-file-directory)))) | ||
| 1242 | (should | ||
| 1243 | (equal tmpfile | ||
| 1244 | (executable-find (file-name-nondirectory tmpfile)))))) | ||
| 1245 | (delete-file tmpfile)))) | ||
| 1246 | |||
| 1221 | (provide 'files-tests) | 1247 | (provide 'files-tests) |
| 1222 | ;;; files-tests.el ends here | 1248 | ;;; files-tests.el ends here |