mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2026-09-10 07:46:51 -04:00
Backport: Use default exec-suffixes when needed (bug#81280, bug#81517)
* lisp/files.el (executable-find): Use (default-value 'exec-suffixes).
* src/callproc.c (Qexec_suffixes): Declare.
(call_process):
* src/process.c (Fmake_process): Use Fdefault_value (Qexec_suffixes).
* test/lisp/files-x-tests.el (files-x-test--variables6):
New defconst.
(files-x-test-connection-local-special-variables): New test.
(cherry picked from commit dcdd76f89e)
This commit is contained in:
parent
ad60eb855d
commit
7b0f33cb74
|
|
@ -1331,7 +1331,7 @@ remote, otherwise search locally."
|
|||
;; Use 1 rather than file-executable-p to better match the
|
||||
;; behavior of call-process.
|
||||
(let ((default-directory (file-name-quote default-directory 'top)))
|
||||
(locate-file command exec-path exec-suffixes 1))))
|
||||
(locate-file command exec-path (default-value 'exec-suffixes) 1))))
|
||||
|
||||
(declare-function read-library-name "find-func" nil)
|
||||
|
||||
|
|
|
|||
|
|
@ -520,7 +520,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
|
|||
{
|
||||
int ok;
|
||||
|
||||
ok = openp (Vexec_path, args[0], Vexec_suffixes, &path,
|
||||
ok = openp (Vexec_path, args[0], Fdefault_value (Qexec_suffixes), &path,
|
||||
make_fixnum (X_OK), false, false, NULL);
|
||||
if (ok < 0)
|
||||
report_file_error ("Searching for program", args[0]);
|
||||
|
|
@ -2258,4 +2258,5 @@ multiple times on subsequent partitions of the list of arguments.
|
|||
DEFSYM (Qafter_insert_file_set_buffer_file_coding_system,
|
||||
"after-insert-file-set-buffer-file-coding-system");
|
||||
DEFSYM (Qcoding_system_for_write, "coding-system-for-write");
|
||||
DEFSYM (Qexec_suffixes, "exec-suffixes");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2032,7 +2032,7 @@ usage: (make-process &rest ARGS) */)
|
|||
&& IS_DEVICE_SEP (SREF (program, 1))))
|
||||
{
|
||||
tem = Qnil;
|
||||
openp (Vexec_path, program, Vexec_suffixes, &tem,
|
||||
openp (Vexec_path, program, Fdefault_value (Qexec_suffixes), &tem,
|
||||
make_fixnum (X_OK), false, false, NULL);
|
||||
if (NILP (tem))
|
||||
report_file_error ("Searching for program", program);
|
||||
|
|
|
|||
|
|
@ -39,6 +39,9 @@
|
|||
(defconst files-x-test--variables5
|
||||
'((remote-lazy-var . nil)
|
||||
(remote-null-device . "/dev/null")))
|
||||
(defconst files-x-test--variables6
|
||||
'((exec-suffixes . ("foo"))
|
||||
(path-separator . "foo")))
|
||||
(defvar remote-shell-file-name)
|
||||
(defvar remote-null-device)
|
||||
(defvar remote-lazy-var nil)
|
||||
|
|
@ -601,5 +604,39 @@ If it's not initialized yet, initialize it."
|
|||
`(connection-local-profile-alist ',clpa now)
|
||||
`(connection-local-criteria-alist ',clca now))))
|
||||
|
||||
(ert-deftest files-x-test-connection-local-special-variables ()
|
||||
"Test special local variables.
|
||||
The connection-local variables `exec-suffixes' and `path-separator' are
|
||||
used for remote processes. When calling `call-process', `make-process'
|
||||
or `executable-find', their default value must be used nonetheless."
|
||||
|
||||
(let ((clpa connection-local-profile-alist)
|
||||
(clca connection-local-criteria-alist)
|
||||
(program (file-name-sans-extension
|
||||
(file-name-concat invocation-directory invocation-name)))
|
||||
proc)
|
||||
(connection-local-set-profile-variables
|
||||
'special-variables files-x-test--variables6)
|
||||
(connection-local-set-profiles
|
||||
nil 'special-variables)
|
||||
|
||||
(unwind-protect
|
||||
(with-temp-buffer
|
||||
(let ((enable-connection-local-variables t))
|
||||
(hack-connection-local-variables-apply nil)
|
||||
(should (zerop (call-process program nil nil nil "--help")))
|
||||
(should
|
||||
(processp
|
||||
(setq proc
|
||||
(make-process
|
||||
:name invocation-name :command `(,program "--help")))))
|
||||
(should (executable-find program))))
|
||||
|
||||
;; Cleanup.
|
||||
(when (processp proc) (kill-process proc))
|
||||
(custom-set-variables
|
||||
`(connection-local-profile-alist ',clpa now)
|
||||
`(connection-local-criteria-alist ',clca now)))))
|
||||
|
||||
(provide 'files-x-tests)
|
||||
;;; files-x-tests.el ends here
|
||||
|
|
|
|||
Loading…
Reference in a new issue